2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-24 15:19:21 +00:00

73_GasCalculator: Bugfix: Unknown "?"-reading no longer created.

git-svn-id: https://svn.fhem.de/fhem/trunk@11695 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
sailor-fhem 2016-06-19 15:20:32 +00:00
parent a8cd69e563
commit c790f6cd4f

View File

@ -151,14 +151,22 @@ sub GasCalculator_Set($@)
return "\"set GasCalculator\" needs at least one argument"; return "\"set GasCalculator\" needs at least one argument";
} }
my $name = shift @a; my $GasCalcName = shift @a;
my $reading = shift @a; my $reading = shift @a;
my $value = join(" ", @a); my $value = join(" ", @a);
my $ReturnMessage; my $ReturnMessage;
### Write current value if ( $reading ne "?")
readingsSingleUpdate($hash, $reading, $value, 1); {
### 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); return($ReturnMessage);
} }
@ -387,7 +395,7 @@ sub GasCalculator_Notify($$)
if(defined($GasCountReadingValuePrevious)) if(defined($GasCountReadingValuePrevious))
{ {
### Write current Volume as previous Voulume for future use in the GasCalc-Device ### 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 ### Create Log entries for debugging
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous value found. Continuing with calculations"; Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous value found. Continuing with calculations";
@ -396,7 +404,7 @@ sub GasCalculator_Notify($$)
else else
{ {
### Write current Volume as previous Voulume for future use in the GasCalc-Device ### 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 ### Create Log entries for debugging
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous value NOT found. Skipping Loop"; Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous value NOT found. Skipping Loop";