2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhem.pl: ReadingsNum will return default if value is non-numeric (Forum #86523)

git-svn-id: https://svn.fhem.de/fhem/trunk@16569 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-04-08 10:52:50 +00:00
parent 165ade23ef
commit e95116bbaa

View File

@ -4183,6 +4183,7 @@ OldReadingsNum($$$;$)
my $val = OldReadingsVal($d,$n,$default);
return undef if(!defined($val));
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
return $default if($val eq "");
$val = round($val,$round) if($round);
return $val;
}
@ -4229,6 +4230,7 @@ ReadingsNum($$$;$)
my $val = ReadingsVal($d,$n,$default);
return undef if(!defined($val));
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
return $default if($val eq "");
$val = round($val,$round) if($round);
return $val;
}