diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 94e832c0b..6bae7512d 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -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; }