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.
# 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
- feature: fhem_codemirror: Added DOIF autocomplete-keywords. Added feature
to autocomplete on any keypress.

View File

@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday);
use HttpUtils;
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 $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/ ) {
my $tv = $data[1];
@ -914,37 +926,16 @@ sub AMAD_CommBridge_Read($) {
my $t;
my $v;
if( $data[2] =~ /FHEMDEVICE:/ ) {
$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 );
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 );
### End Response Processing
return;
@ -969,21 +960,7 @@ sub AMAD_CommBridge_Read($) {
elsif ( $data[0] =~ /FHEMCMD: statusrequest\b/ ) {
@data = split( '\R', $data[0] );
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 );
}
return AMAD_GetUpdateLocal( $chash );
}
}