86_Robonect.pm: ABU 20170427 fixed numerich undefs

git-svn-id: https://svn.fhem.de/fhem/trunk@14124 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
andi291
2017-04-28 07:26:09 +00:00
parent 44a899a0a7
commit aaabe5a13d

View File

@@ -22,6 +22,7 @@
# ABU 20170301 fixed hybernate-check in set
# ABU 20170406 fixed hybernate-check in timer
# ABU 20170422 fixed doku
# ABU 20170427 fixed numerich undefs
package main;
@@ -562,7 +563,7 @@ sub Robonect_callback ($)
readingsBulkUpdate($hash, $key, $value);
$value = 0;
($key, $value) = Robonect_decodeContent ($hash, $answer, "status", "duration", undef);
readingsBulkUpdate($hash, $key, sprintf ("%d", $value/3600));
readingsBulkUpdate($hash, $key, sprintf ("%d", $value/3600)) if (defined($value) and ($value =~ m/(?:\d*\.)?\d+/));
($key, $value) = Robonect_decodeContent ($hash, $answer, "status", "hours", undef);
readingsBulkUpdate($hash, $key, $value);
@@ -578,7 +579,7 @@ sub Robonect_callback ($)
($key, $value) = Robonect_decodeContent ($hash, $answer, "wlan", "signal", undef);
readingsBulkUpdate($hash, $key, $value);
if (defined($value))
if (defined($value) and ($value =~ m/(?:\d*\.)?\d+/))
{
$value = sprintf ("%d", ($value + 95) / 0.6);
readingsBulkUpdate($hash, $key . "-prozent", $value);