mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +00:00
74_AMAD: New Minor Release 2.4 new AMADCommBridge API
git-svn-id: https://svn.fhem.de/fhem/trunk@11803 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c45fcf8c7e
commit
bef6315115
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- updated: 74_AMAD: New Minor Release 2.4 new AMADCommBridge API
|
||||||
- changed: 10_ZWave: alarm Events text changed, comma replaced, Forum #53389
|
- changed: 10_ZWave: alarm Events text changed, comma replaced, Forum #53389
|
||||||
- feature: 93_DbRep: new module added - reporting of database content
|
- feature: 93_DbRep: new module added - reporting of database content
|
||||||
written by DbLog, see commandref for details
|
written by DbLog, see commandref for details
|
||||||
|
@ -37,8 +37,8 @@ use TcpServerUtils;
|
|||||||
use Encode qw(encode);
|
use Encode qw(encode);
|
||||||
|
|
||||||
|
|
||||||
my $modulversion = "2.2.4";
|
my $modulversion = "2.4.0";
|
||||||
my $flowsetversion = "2.2.4";
|
my $flowsetversion = "2.4.0";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -278,15 +278,15 @@ sub AMAD_statusRequest($) {
|
|||||||
my $activetask = AttrVal( $name, "checkActiveTask", "none" );
|
my $activetask = AttrVal( $name, "checkActiveTask", "none" );
|
||||||
|
|
||||||
|
|
||||||
my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Path muß so im Automagic als http request Trigger drin stehen
|
my $url = "http://" . $host . ":" . $port . "/fhem-amad/deviceInfo/"; # Pfad muß so im Automagic als http request Trigger drin stehen
|
||||||
|
|
||||||
HttpUtils_NonblockingGet(
|
HttpUtils_NonblockingGet(
|
||||||
{
|
{
|
||||||
url => $url,
|
url => $url,
|
||||||
timeout => 30,
|
timeout => 15,
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
method => "GET",
|
method => "GET",
|
||||||
header => "fhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport",
|
header => "Connection: close\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport",
|
||||||
doTrigger => 1,
|
doTrigger => 1,
|
||||||
callback => \&AMAD_statusRequestErrorHandling,
|
callback => \&AMAD_statusRequestErrorHandling,
|
||||||
}
|
}
|
||||||
@ -904,6 +904,7 @@ sub AMAD_HTTP_POST($$) {
|
|||||||
timeout => 60,
|
timeout => 60,
|
||||||
hash => $hash,
|
hash => $hash,
|
||||||
method => "POST",
|
method => "POST",
|
||||||
|
header => "Connection: close",
|
||||||
doTrigger => 1,
|
doTrigger => 1,
|
||||||
callback => \&AMAD_HTTP_POSTerrorHandling,
|
callback => \&AMAD_HTTP_POSTerrorHandling,
|
||||||
}
|
}
|
||||||
@ -1092,10 +1093,9 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
my $bname = $bhash->{NAME};
|
my $bname = $bhash->{NAME};
|
||||||
|
|
||||||
|
|
||||||
## Zum testen mal ausgeschalten
|
|
||||||
if( $hash->{SERVERSOCKET} ) { # Accept and create a child
|
if( $hash->{SERVERSOCKET} ) { # Accept and create a child
|
||||||
TcpServer_Accept( $hash, "AMAD" );
|
TcpServer_Accept( $hash, "AMAD" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1103,6 +1103,8 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
my $buf;
|
my $buf;
|
||||||
my $ret = sysread($hash->{CD}, $buf, 1024);
|
my $ret = sysread($hash->{CD}, $buf, 1024);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# When there is an error in connection return
|
# When there is an error in connection return
|
||||||
if( !defined($ret ) || $ret <= 0 ) {
|
if( !defined($ret ) || $ret <= 0 ) {
|
||||||
CommandDelete( undef, $hash->{NAME} );
|
CommandDelete( undef, $hash->{NAME} );
|
||||||
@ -1121,12 +1123,13 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
my @data = split( '\R\R', $buf );
|
my @data = split( '\R\R', $buf );
|
||||||
|
|
||||||
my $header = AMAD_Header2Hash( $data[0] );
|
my $header = AMAD_Header2Hash( $data[0] );
|
||||||
my $device = $header->{FHEMDEVICE} if(defined($header->{FHEMDEVICE}));
|
|
||||||
my $dhash = $defs{$device};
|
|
||||||
my $response;
|
my $response;
|
||||||
my $c;
|
my $c;
|
||||||
|
my $device = $header->{FHEMDEVICE} if(defined($header->{FHEMDEVICE}));
|
||||||
|
my $fhemcmd = $header->{FHEMCMD} if(defined($header->{FHEMCMD}));
|
||||||
|
my $dhash = $defs{$device} if( $defs{$device} );
|
||||||
|
|
||||||
|
|
||||||
my $fhemcmd = $header->{FHEMCMD};
|
|
||||||
|
|
||||||
|
|
||||||
if ( $data[0] =~ /currentFlowsetUpdate.xml/ ) {
|
if ( $data[0] =~ /currentFlowsetUpdate.xml/ ) {
|
||||||
@ -1136,6 +1139,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1149,6 +1153,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1156,6 +1161,16 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
elsif( !defined($device) ) {
|
||||||
|
readingsSingleUpdate( $bhash, "transmitterERROR", $name." has no device name sends", 1 );
|
||||||
|
Log3 $name, 4, "AMAD ($name) - ERROR - no device name given. please check your global variable in automagic";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
elsif ( $fhemcmd =~ /setreading\b/ ) {
|
elsif ( $fhemcmd =~ /setreading\b/ ) {
|
||||||
my $tv = $data[1];
|
my $tv = $data[1];
|
||||||
|
|
||||||
@ -1167,6 +1182,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1184,6 +1200,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1203,6 +1220,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1217,6 +1235,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1241,6 +1260,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
|
|
||||||
@ -1252,6 +1272,7 @@ sub AMAD_CommBridge_Read($) {
|
|||||||
$c = $hash->{CD};
|
$c = $hash->{CD};
|
||||||
print $c "HTTP/1.1 200 OK\r\n",
|
print $c "HTTP/1.1 200 OK\r\n",
|
||||||
"Content-Type: text/plain\r\n",
|
"Content-Type: text/plain\r\n",
|
||||||
|
"Connection: close\r\n",
|
||||||
"Content-Length: ".length($response)."\r\n\r\n",
|
"Content-Length: ".length($response)."\r\n\r\n",
|
||||||
$response;
|
$response;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user