2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-12 02:39:57 +00:00

speedtest: set state to one of ok,failed,running to indicate status

git-svn-id: https://svn.fhem.de/fhem/trunk@6631 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2014-09-29 12:52:53 +00:00
parent bee1002750
commit bd58157c4e

View File

@ -112,6 +112,7 @@ speedtest_GetUpdate($)
}
}
readingsSingleUpdate($hash,"state", "running", 1);
$hash->{helper}{RUNNING_PID} = BlockingCall("speedtest_DoSpeedtest", $name."|".$server, "speedtest_SpeedtestDone", 300, "speedtest_SpeedtestAborted", $hash) unless(exists($hash->{helper}{RUNNING_PID}));
}
@ -154,13 +155,17 @@ speedtest_SpeedtestDone($)
Log3 $hash, 5, "speedtest_SpeedtestDone: $string";
return if( $a[1] eq "Invalid server ID" );
if( $a[1] eq "Invalid server ID" ) {
readingsSingleUpdate($hash,"state", "failed", 1);
return;
}
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"ping",$a[1]);
readingsBulkUpdate($hash,"download",$a[2]);
readingsBulkUpdate($hash,"upload",$a[3]);
readingsBulkUpdate($hash,"state",defined($a[3])?"ok":"failed");
readingsEndUpdate($hash,1);
}