diff --git a/fhem/FHEM/17_EGPM2LAN.pm b/fhem/FHEM/17_EGPM2LAN.pm
index 2c800b369..eb3cf6140 100644
--- a/fhem/FHEM/17_EGPM2LAN.pm
+++ b/fhem/FHEM/17_EGPM2LAN.pm
@@ -1,9 +1,9 @@
##############################################
-# $Id: EGPM2LAN.pm 2013-12-08 10:11:20Z alexus $
+# $Id$
#
# based / modified Version 98_EGPMS2LAN from ericl
#
-# (c) 2013 Copyright: Alex Storny (moselking at arcor dot de)
+# (c) 2013, 2014 Copyright: Alex Storny (moselking at arcor dot de)
# All rights reserved
#
# This script free software; you can redistribute it and/or modify
@@ -97,11 +97,11 @@ EGPM2LAN_Set($@)
{ #switch single Socket
EGPM2LAN_Switch($hash, $setcommand, $params, $logLevel);
}
- EGPM2LAN_Statusrequest($hash, $logLevel);
+ EGPM2LAN_Statusrequest($hash, $logLevel, 1);
}
elsif($setcommand eq "toggle")
{
- my $currentstate = EGPM2LAN_Statusrequest($hash, $logLevel);
+ my $currentstate = EGPM2LAN_Statusrequest($hash, $logLevel, 1);
if(defined($currentstate))
{
my @powerstates = split(",", $currentstate);
@@ -111,12 +111,12 @@ EGPM2LAN_Set($@)
$newcommand="on";
}
EGPM2LAN_Switch($hash, $newcommand, $params, $logLevel);
- EGPM2LAN_Statusrequest($hash, $logLevel);
+ EGPM2LAN_Statusrequest($hash, $logLevel, 0);
}
}
elsif($setcommand eq "statusrequest")
{
- EGPM2LAN_Statusrequest($hash, $logLevel);
+ EGPM2LAN_Statusrequest($hash, $logLevel, 1);
}
elsif($setcommand eq "clearreadings")
{
@@ -209,8 +209,8 @@ sub EGPM2LAN_GetDeviceInfo($$) {
}
################################
-sub EGPM2LAN_Statusrequest($$) {
- my ($hash, $logLevel) = @_;
+sub EGPM2LAN_Statusrequest($$$) {
+ my ($hash, $logLevel, $autoCr) = @_;
my $name = $hash->{NAME};
my $response = CustomGetFileFromURL($hash, "http://".$hash->{IP}."/", 10, "", 0, $logLevel);
@@ -244,7 +244,7 @@ sub EGPM2LAN_Statusrequest($$) {
#Create Socket-Object if not available
my $defptr = $modules{EGPM}{defptr}{$name.$index};
- if(AttrVal($name, "autocreate", "on") eq "on" && not defined($defptr))
+ if($autoCr && AttrVal($name, "autocreate", "on") eq "on" && not defined($defptr))
{
if(Value("autocreate") eq "active")
{
@@ -295,7 +295,7 @@ sub EGPM2LAN_Statusrequest($$) {
sub EGPM2LAN_Logoff($$) {
my ($hash, $logLevel) = @_;
- #$quiet, $url, $timeout, $data, $noshutdown, $loglevel
+ #$quiet, $url, $timeout, $data, $noshutdown, $loglevel
CustomGetFileFromURL($hash, "http://".$hash->{IP}."/login.html", 10, "", 0, $logLevel);
return 1;
}
@@ -321,10 +321,9 @@ EGPM2LAN_Define($$)
my $result = EGPM2LAN_Login($hash, 3);
if($result == 1)
{
- #delayed auto-create
- #InternalTimer(gettimeofday()+ 3, "EGPM2LAN_Statusrequest", $hash, 4);
- EGPM2LAN_Logoff($hash, 4);
$hash->{STATE} = "initialized";
+ EGPM2LAN_Statusrequest($hash, 4, 0);
+ EGPM2LAN_Logoff($hash, 4);
}
return undef;
@@ -346,7 +345,7 @@ EGPM2LAN_Define($$)
Creates a Gembird ® Energenie EG-PM2-LAN device to switch up to 4 sockets over the network.
If you have more than one device, it is helpful to connect and set names for your sockets over the web-interface first.
- The name settings will be adopted to FHEM and helps you to identify the sockets. Please make sure that you´re logged off from the Energenie web-interface otherwise you can´t control it with FHEM at the same time.
+ The name settings will be adopted to FHEM and helps you to identify the sockets. Please make sure that you´re logged off from the Energenie web-interface otherwise you can´t control it with FHEM at the same time.
EG-PMS2-LAN with surge protector feature was not tested until now.
@@ -403,7 +402,7 @@ EGPM2LAN_Define($$)
define <name> EGPM2LAN <IP-Address> [<Password>]
- set <name> <[on|off|toggle]>
set <name> <[on|off|toggle]>set <name> <[on-for-timer|off-for-timer|on-till|off-till|blink|intervals]>
- set <name> <[on|off|toggle]>
set <name> <[on|off|toggle]>set <name> <[on-for-timer|off-for-timer|on-till|off-till|blink|intervals]>