Hallo @Rudi,
bezogen auf diesen Thread
https://forum.fhem.de/index.php/topic,117041.0.html (https://forum.fhem.de/index.php/topic,117041.0.html)
stelle ich dir hier einen Patch bereit.
Die Mehrzahl der Schreibenden sind sich einig, dass es zur Verwirrung führt, wenn
ReadingsNum('device','value',undef,0)
keine Ganzzahl ausgibt, sondern value unberührt lässt.
Danke an @xenos1984 für den Lösungsvorschlag.
Die Änderung habe ich vorher getestet.
--- fhem.pl 2021-07-29 17:42:34.446656774 +0200
+++ fhem.pl 2021-07-29 17:52:15.000000000 +0200
@@ -4572,7 +4572,7 @@ OldReadingsNum($$$;$)
return undef if(!defined($val));
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
return $default if($val eq "");
- $val = round($val,$round) if($round);
+ $val = round($val,$round) if(defined $round);
return $val;
}
@@ -4619,7 +4619,7 @@ ReadingsNum($$$;$)
return undef if(!defined($val));
$val = ($val =~ /(-?\d+(\.\d+)?)/ ? $1 : "");
return $default if($val eq "");
- $val = round($val,$round) if($round);
+ $val = round($val,$round) if(defined $round);
return $val;
}
Danke und Grüße Bernd
Danke, habs eingecheckt.