fix bugs and change statusRequest

This commit is contained in:
Marko Oldenburg 2017-12-15 06:32:58 +01:00
parent ff9e647dfc
commit 91c5483513
2 changed files with 10 additions and 13 deletions

View File

@ -74,7 +74,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode ";
eval "use JSON;1" or $missingModul .= "JSON "; eval "use JSON;1" or $missingModul .= "JSON ";
my $modulversion = "4.1.99.3"; my $modulversion = "4.1.99.8";
my $flowsetversion = "4.0.11"; my $flowsetversion = "4.0.11";
@ -248,7 +248,7 @@ sub AMADCommBridge_Write($@) {
my ($hash,$amad_id,$uri,$path,$header,$method) = @_; my ($hash,$amad_id,$uri,$path,$header,$method) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $dhash = $defs{$amad_id}; my $dhash = $modules{AMADDevice}{defptr}{$amad_id};
my $param; my $param;
my $remoteServer = AttrVal($dhash->{NAME},'remoteServer','Automagic'); my $remoteServer = AttrVal($dhash->{NAME},'remoteServer','Automagic');

View File

@ -58,7 +58,7 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode ";
eval "use JSON;1" or $missingModul .= "JSON "; eval "use JSON;1" or $missingModul .= "JSON ";
my $modulversion = "4.1.99.3"; my $modulversion = "4.1.99.8";
my $flowsetversion = "4.0.11"; my $flowsetversion = "4.0.11";
@ -349,9 +349,9 @@ sub AMADDevice_statusRequest($) {
my $host = $hash->{HOST}; my $host = $hash->{HOST};
my $port = $hash->{PORT}; my $port = $hash->{PORT};
my $amad_id = $hash->{AMAD_ID}; my $amad_id = $hash->{AMAD_ID};
my $uri; my $uri = $hash->{HOST} . ":" . $hash->{PORT};
my $path;
my $header = 'Connection: close'; my $header = 'Connection: close';
my $path;
my $method; my $method;
@ -361,18 +361,15 @@ sub AMADDevice_statusRequest($) {
my $fhemip = ReadingsVal($hash->{IODev}->{NAME}, "fhemServerIP", "none"); my $fhemip = ReadingsVal($hash->{IODev}->{NAME}, "fhemServerIP", "none");
my $fhemCtlMode = AttrVal($hash->{IODev}->{NAME},'fhemControlMode','none' ); my $fhemCtlMode = AttrVal($hash->{IODev}->{NAME},'fhemControlMode','none' );
my $bport = $hash->{IODev}->{PORT}; my $bport = $hash->{IODev}->{PORT};
my $remoteServer = AttrVal( $name, "remoteServer", "Automagic" );
$header .= "\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState\r\namadid: $amad_id\r\nfhemctlmode: $fhemCtlMode"; $header .= "\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState\r\namadid: $amad_id\r\nfhemctlmode: $fhemCtlMode";
$method = "GET"; $method = "GET";
$path ="/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen $path ="/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen
readingsSingleUpdate( $hash, "lastSetCommand", $path, 1 ); readingsSingleUpdate( $hash, "lastSetCommand", $path, 1 );
if ($remoteServer eq "Automagic"){
$uri = $host . ":" . $port . $path; IOWrite($hash,$amad_id,$uri,$path,$header,$method);
IOWrite($hash,$amad_id,$uri,$header,$method); Log3 $name, 5, "AMADDevice ($name) - IOWrite: $uri $method IODevHash=$hash->{IODev}";
Log3 $name, 5, "AMADDevice ($name) - IOWrite: $uri $method IODevHash=$hash->{IODev}";
}
} }
sub AMADDevice_WriteReadings($$) { sub AMADDevice_WriteReadings($$) {