2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

74_AMAD: Bessere Variante zur HTTP Headeranalyse, Code aufgeräumt

git-svn-id: https://svn.fhem.de/fhem/trunk@9788 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markooldenburg 2015-11-05 11:52:54 +00:00
parent 7221c24607
commit 295464aee3
2 changed files with 23 additions and 45 deletions

View File

@ -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.
- bugfix: 74_AMAD: Bessere Variante zur HTTP Headeranalyse, Code aufgeräumt
- bugfix: 74_AMAD: AMADCommBridge communication problem with automagic 1.29 - bugfix: 74_AMAD: AMADCommBridge communication problem with automagic 1.29
- feature: fhem_codemirror: Added DOIF autocomplete-keywords. Added feature - feature: fhem_codemirror: Added DOIF autocomplete-keywords. Added feature
to autocomplete on any keypress. to autocomplete on any keypress.

View File

@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday);
use HttpUtils; use HttpUtils;
use TcpServerUtils; use TcpServerUtils;
my $version = "0.8.2"; my $version = "0.8.3";
@ -894,7 +894,19 @@ sub AMAD_CommBridge_Read($) {
### ###
my @data = split( '\R\R', $buf ); my @data = split( '\R\R', $buf );
my $chash = undef; my $chash;
my $fhemdev;
my @fhemdev = split( '\R', $data[0] );
foreach my $ret( @fhemdev ) {
if( $ret =~ /FHEMDEVICE: (.*)/ ) {
$fhemdev = $1;
}
}
$chash = $defs{$fhemdev};
if ( $data[0] =~ /FHEMCMD: setreading\b/ ) { if ( $data[0] =~ /FHEMCMD: setreading\b/ ) {
my $tv = $data[1]; my $tv = $data[1];
@ -914,37 +926,16 @@ sub AMAD_CommBridge_Read($) {
my $t; my $t;
my $v; my $v;
if( $data[2] =~ /FHEMDEVICE:/ ) { while( ( $t, $v ) = each %buffer ) {
$v =~ s/null//g;
$data[2] =~ s/FHEMDEVICE: //;
my $chash = $defs{$data[2]};
while( ( $t, $v ) = each %buffer ) {
$v =~ s/null//g;
readingsBeginUpdate( $chash );
readingsBulkUpdate( $chash, $t, $v ) if( defined( $v ) );
}
readingsBulkUpdate( $chash, "lastStatusRequestState", "statusRequest_done" );
readingsEndUpdate( $chash, 1 );
} else {
$data[3] =~ s/FHEMDEVICE: //;
my $chash = $defs{$data[3]};
while( ( $t, $v ) = each %buffer ) {
$v =~ s/null//g;
readingsBeginUpdate( $chash );
readingsBulkUpdate( $chash, $t, $v ) if( defined( $v ) );
}
readingsBulkUpdate( $chash, "lastStatusRequestState", "statusRequest_done" );
readingsEndUpdate( $chash, 1 );
readingsBeginUpdate( $chash );
readingsBulkUpdate( $chash, $t, $v ) if( defined( $v ) );
} }
readingsBulkUpdate( $chash, "lastStatusRequestState", "statusRequest_done" );
readingsEndUpdate( $chash, 1 );
### End Response Processing ### End Response Processing
return; return;
@ -969,21 +960,7 @@ sub AMAD_CommBridge_Read($) {
elsif ( $data[0] =~ /FHEMCMD: statusrequest\b/ ) { elsif ( $data[0] =~ /FHEMCMD: statusrequest\b/ ) {
@data = split( '\R', $data[0] ); return AMAD_GetUpdateLocal( $chash );
if( $data[2] =~ /FHEMDEVICE:/ ) {
$data[2] =~ s/FHEMDEVICE: //;
my $chash = $defs{$data[2]};
return AMAD_GetUpdateLocal( $chash );
} else {
$data[3] =~ s/FHEMDEVICE: //;
my $chash = $defs{$data[3]};
return AMAD_GetUpdateLocal( $chash );
}
} }
} }