From f7fc3d9b0233e3879644ce60e97d484006eb7bac Mon Sep 17 00:00:00 2001 From: sailor-fhem Date: Sun, 19 Jun 2016 15:20:32 +0000 Subject: [PATCH] 73_GasCalculator: Bugfix: Unknown "?"-reading no longer created. git-svn-id: https://svn.fhem.de/fhem/trunk@11695 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_GasCalculator.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/73_GasCalculator.pm b/fhem/FHEM/73_GasCalculator.pm index 1e4e232d4..1aeacc9de 100644 --- a/fhem/FHEM/73_GasCalculator.pm +++ b/fhem/FHEM/73_GasCalculator.pm @@ -151,14 +151,22 @@ sub GasCalculator_Set($@) return "\"set GasCalculator\" needs at least one argument"; } - my $name = shift @a; + my $GasCalcName = shift @a; my $reading = shift @a; my $value = join(" ", @a); my $ReturnMessage; - ### Write current value - readingsSingleUpdate($hash, $reading, $value, 1); - + if ( $reading ne "?") + { + ### Create Log entries for debugging + Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - set " . $reading . " with value: " . $value; + + ### Write current value + readingsSingleUpdate($hash, $reading, $value, 1); + + ### Create ReturnMessage + $ReturnMessage = $GasCalcName . " - Successfully set " . $reading . " with value: " . $value; + } return($ReturnMessage); } @@ -387,7 +395,7 @@ sub GasCalculator_Notify($$) if(defined($GasCountReadingValuePrevious)) { ### Write current Volume as previous Voulume for future use in the GasCalc-Device - readingsSingleUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix. "_PrevRead", sprintf('%.3f', ($GasCountReadingValueCurrent)),1); + readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix. "_PrevRead", sprintf('%.3f', ($GasCountReadingValueCurrent)),1); ### Create Log entries for debugging Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous value found. Continuing with calculations"; @@ -396,7 +404,7 @@ sub GasCalculator_Notify($$) else { ### Write current Volume as previous Voulume for future use in the GasCalc-Device - readingsSingleUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix. "_PrevRead", sprintf('%.3f', ($GasCountReadingValueCurrent)),1); + readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix. "_PrevRead", sprintf('%.3f', ($GasCountReadingValueCurrent)),1); ### Create Log entries for debugging Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous value NOT found. Skipping Loop";