mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
fhem.pl: ReadingsNum fix (Forum #137283)
git-svn-id: https://svn.fhem.de/fhem/trunk@28577 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
91153c257c
commit
87014e0b48
@ -4666,6 +4666,7 @@ OldReadingsNum($$$;$)
|
||||
my ($d,$n,$default,$round) = @_;
|
||||
my $val = OldReadingsVal($d,$n,$default);
|
||||
return undef if(!defined($val));
|
||||
return $val if(looks_like_number($val)); # 137283
|
||||
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
|
||||
$val =~ s/^(-?)0+([1-9])/$1$2/; # Forum #135120, dont want octal numbers
|
||||
return $default if($val eq "");
|
||||
@ -4714,6 +4715,7 @@ ReadingsNum($$$;$)
|
||||
my ($d,$n,$default,$round) = @_;
|
||||
my $val = ReadingsVal($d,$n,$default);
|
||||
return undef if(!defined($val));
|
||||
return $val if(looks_like_number($val)); # 137283
|
||||
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
|
||||
$val =~ s/^(-?)0+([1-9])/$1$2/; # Forum #135120, dont want octal numbers
|
||||
return $default if($val eq "");
|
||||
|
Loading…
Reference in New Issue
Block a user