fixed use of STATE

git-svn-id: https://svn.fhem.de/fhem/trunk@2435 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert
2013-01-04 18:58:17 +00:00
parent 1f5be1992d
commit d82c22bd4c

View File

@@ -170,8 +170,6 @@ OWDevice_ReadValue($$) {
#Debug "/$address/$reading => $value"; #Debug "/$address/$reading => $value";
if(defined($value)) { if(defined($value)) {
$value= trim($value) if(AttrVal($hash,"trimvalues",1)); $value= trim($value) if(AttrVal($hash,"trimvalues",1));
my @getters= @{$hash->{fhem}{getters}};
$hash->{STATE}= "$reading: $value" if($reading eq $getters[0]);
} else { } else {
Log 3, $hash->{NAME} . ": reading $reading did not return a value"; Log 3, $hash->{NAME} . ": reading $reading did not return a value";
} }
@@ -197,12 +195,16 @@ OWDevice_UpdateValues($) {
my ($hash)= @_; my ($hash)= @_;
my @polls= @{$hash->{fhem}{polls}}; my @polls= @{$hash->{fhem}{polls}};
my @getters= @{$hash->{fhem}{getters}};
if($#polls>=0) { if($#polls>=0) {
my $address= $hash->{fhem}{address}; my $address= $hash->{fhem}{address};
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
foreach my $reading (@polls) { foreach my $reading (@polls) {
my $value= OWDevice_ReadValue($hash,$reading); my $value= OWDevice_ReadValue($hash,$reading);
readingsBulkUpdate($hash,$reading,$value) if(defined($value)); if(defined($value)) {
readingsBulkUpdate($hash,$reading,$value);
readingsBulkUpdate($hash,"state","$reading: $value") if($reading eq $getters[0]);
}
} }
readingsEndUpdate($hash,1); readingsEndUpdate($hash,1);
} }