2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

additional patch for nonblocking mode

git-svn-id: https://svn.fhem.de/fhem/trunk@4444 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2013-12-22 21:08:44 +00:00
parent 8f418d4a16
commit e175b2b19f

View File

@ -471,40 +471,47 @@ OWDevice_UpdateValues($) {
my $state;
if($#polls>=0) {
my $address= $hash->{fhem}{address};
my $read_failed = 0;
readingsBeginUpdate($hash);
foreach my $reading (@polls) {
my $value= OWDevice_ReadValue($hash,$reading);
if(defined($value)) {
readingsBulkUpdate($hash,$reading,$value);
} else {
$read_failed = 1;
}
}
if(@state) {
foreach my $reading (@state) {
my $value= ReadingsVal($hash->{NAME},$reading,undef);
if(defined($value)) {
$state .= "$reading: $value ";
} else {
$state .= "$reading: n/a ";
if( !$read_failed ) {
if(@state) {
foreach my $reading (@state) {
my $value= ReadingsVal($hash->{NAME},$reading,undef);
if(defined($value)) {
$state .= "$reading: $value ";
} else {
$state .= "$reading: n/a ";
}
}
}
if($alerting) {
my $dir= OWDevice_ReadFromServer($hash,"dir","/alarm/");
my $alarm= (defined($dir) && $dir =~ m/$address/) ? 1 :0;
readingsBulkUpdate($hash,"alarm",$alarm);
$state .= "alarm: $alarm";
}
if($interface eq "id") {
my $dir= OWDevice_ReadFromServer($hash,"dir","/");
my $present= (defined($dir) && $dir =~ m/$address/) ? 1 :0;
readingsBulkUpdate($hash,"present",$present);
$state .= "present: $present";
my $bus= OWDevice_ReadFromServer($hash,"find",$address);
my $location= (defined($bus)) ? $bus :"absent";
readingsBulkUpdate($hash,"location",$location);
}
$state =~ s/\s+$//;
readingsBulkUpdate($hash,"state",$state,0);
} else {
readingsBulkUpdate($hash,"state","read failed",0);
}
if($alerting) {
my $dir= OWDevice_ReadFromServer($hash,"dir","/alarm/");
my $alarm= (defined($dir) && $dir =~ m/$address/) ? 1 :0;
readingsBulkUpdate($hash,"alarm",$alarm);
$state .= "alarm: $alarm";
}
if($interface eq "id") {
my $dir= OWDevice_ReadFromServer($hash,"dir","/");
my $present= (defined($dir) && $dir =~ m/$address/) ? 1 :0;
readingsBulkUpdate($hash,"present",$present);
$state .= "present: $present";
my $bus= OWDevice_ReadFromServer($hash,"find",$address);
my $location= (defined($bus)) ? $bus :"absent";
readingsBulkUpdate($hash,"location",$location);
}
$state =~ s/\s+$//;
readingsBulkUpdate($hash,"state",$state,0);
readingsEndUpdate($hash,1);
}
RemoveInternalTimer($hash);