mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +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:
parent
bee1002750
commit
bd58157c4e
@ -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}));
|
$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";
|
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);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
readingsBulkUpdate($hash,"ping",$a[1]);
|
readingsBulkUpdate($hash,"ping",$a[1]);
|
||||||
readingsBulkUpdate($hash,"download",$a[2]);
|
readingsBulkUpdate($hash,"download",$a[2]);
|
||||||
readingsBulkUpdate($hash,"upload",$a[3]);
|
readingsBulkUpdate($hash,"upload",$a[3]);
|
||||||
|
readingsBulkUpdate($hash,"state",defined($a[3])?"ok":"failed");
|
||||||
|
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user