2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

73_GasCalculator: feature: System readings are hidden now

git-svn-id: https://svn.fhem.de/fhem/trunk@12103 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
sailor-fhem 2016-09-01 07:03:50 +00:00
parent 2f65f56ded
commit a72e99109a

View File

@ -435,8 +435,8 @@ sub GasCalculator_Notify($$)
}
### Restore previous Counter and if not available define it with "undef"
my $GasCountReadingTimestampPrevious = ReadingsTimestamp($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_PrevRead", undef);
my $GasCountReadingValuePrevious = ReadingsVal($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_PrevRead", undef);
my $GasCountReadingTimestampPrevious = ReadingsTimestamp($GasCalcReadingDestinationDeviceName, "." . $GasCalcReadingPrefix . "_PrevRead", undef);
my $GasCountReadingValuePrevious = ReadingsVal($GasCalcReadingDestinationDeviceName, "." . $GasCalcReadingPrefix . "_PrevRead", undef);
### Create Log entries for debugging
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - GasCountReadingValuePrevious : " . $GasCountReadingValuePrevious;
@ -446,7 +446,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";
@ -455,7 +455,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";
@ -469,12 +469,12 @@ sub GasCalculator_Notify($$)
if(!defined(ReadingsVal($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_Vol1stDay", undef)))
{
### Save current Volume as first reading of day = first after midnight and reset min, max value, value counter and value sum
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_Vol1stDay", $GasCountReadingValueCurrent, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_VolLastDay", $GasCountReadingValuePrevious, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDaySum", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayCount", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMin", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMax", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_Vol1stDay", $GasCountReadingValueCurrent, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_VolLastDay", $GasCountReadingValuePrevious, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_PowerDaySum", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_PowerDayCount", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMin", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMax", 0, 1);
### Create Log entries for debugging
Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - Reading for the first daily value was not available and therfore reading and statistics have been written";
@ -539,12 +539,12 @@ sub GasCalculator_Notify($$)
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_EnergyDayLast", (sprintf('%.3f', ($GasCalcEnergyDayLast))), 1);
### Save current Volume as first reading of day = first after midnight and reset min, max value, value counter and value sum
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_Vol1stDay", $GasCountReadingValueCurrent, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_VolLastDay", $GasCountReadingValuePrevious, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDaySum", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayCount", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMin", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMax", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_Vol1stDay", $GasCountReadingValueCurrent, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_VolLastDay", $GasCountReadingValuePrevious, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_PowerDaySum", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_PowerDayCount", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMin", 0, 1);
readingsSingleUpdate( $GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayMax", 0, 1);
### Check whether the current value is the first one after change of month
if ($GasCountReadingTimestampCurrentMday < $GasCountReadingTimestampPreviousMday)
@ -626,8 +626,8 @@ sub GasCalculator_Notify($$)
my $GasCalcPowerCurrent = ($GasCountReadingValueDelta / $GasCountReadingTimestampDelta) * $attr{$GasCalcName}{GaszValue} * $attr{$GasCalcName}{GasNominalHeatingValue} * 3600;
### Calculate daily sum of power measurements "SP" and measurement counts "n" and then calculate average Power "Paverage = SP/n"
my $GasCalcPowerDaySum = ReadingsVal($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_PowerDaySum", "0") + $GasCalcPowerCurrent;
my $GasCalcPowerDayCount = ReadingsVal($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_PowerDayCount", "0") + 1;
my $GasCalcPowerDaySum = ReadingsVal($GasCalcReadingDestinationDeviceName, "." . $GasCalcReadingPrefix . "_PowerDaySum", "0") + $GasCalcPowerCurrent;
my $GasCalcPowerDayCount = ReadingsVal($GasCalcReadingDestinationDeviceName, "." . $GasCalcReadingPrefix . "_PowerDayCount", "0") + 1;
my $GasCalcPowerDayAverage = $GasCalcPowerDaySum / $GasCalcPowerDayCount;
### Calculate consumed Energy of current day W = (Vcurrent[cubic] - V1stReadDay[cubic]) * GaszValue * GasNominalHeatingValue[kWh/cubic]
@ -695,10 +695,10 @@ sub GasCalculator_Notify($$)
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_Meter", sprintf('%.3f', ($GasCountReadingValueCurrent)));
### Write consumed volume (DV) since last measurement
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_LastDV", sprintf('%.3f', ($GasCountReadingValueDelta)));
readingsBulkUpdate($GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_LastDV", sprintf('%.3f', ($GasCountReadingValueDelta)));
### Write timelap (Dt) since last measurement
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_LastDt", sprintf('%.0f', ($GasCountReadingTimestampDelta)));
readingsBulkUpdate($GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_LastDt", sprintf('%.0f', ($GasCountReadingTimestampDelta)));
### Write current Power = average Power over last measurement period
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerCurrent", sprintf('%.3f', ($GasCalcPowerCurrent)));
@ -707,10 +707,10 @@ sub GasCalculator_Notify($$)
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayAver", sprintf('%.3f', ($GasCalcPowerDayAverage)));
### Write Power measurement sum since midnight for average calculation
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDaySum", sprintf('%.3f', ($GasCalcPowerDaySum)));
readingsBulkUpdate($GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_PowerDaySum", sprintf('%.3f', ($GasCalcPowerDaySum)));
### Write Power measurement counts since midnight for average calculation
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_PowerDayCount", sprintf('%.0f', ($GasCalcPowerDayCount)));
readingsBulkUpdate($GasCalcReadingDestinationDevice, "." . $GasCalcReadingPrefix . "_PowerDayCount", sprintf('%.0f', ($GasCalcPowerDayCount)));
### Detect new daily minimum power value and write to reading
if (ReadingsVal($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_PowerDayMin", 0) > $GasCalcPowerCurrent)
@ -1203,28 +1203,6 @@ sub GasCalculator_Notify($$)
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_LastDV</code> : </li></td><td>Difference of chosen Volume between current and previous reading (&Delta;V).<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_LastDt</code> : </li></td><td>Difference of time in seconds between current and previous reading (&Delta;t).<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
@ -1258,28 +1236,6 @@ sub GasCalculator_Notify($$)
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_PowerDayCount</code> : </li></td><td>Number of power measurements since midnight. (Required for average calculations)<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_PowerDaySum</code> : </li></td><td>Sum of power measurements since midnight. (Required for average calculations)<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
@ -1302,17 +1258,6 @@ sub GasCalculator_Notify($$)
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_PrevRead</code> : </li></td><td>Reading of previous volume measurement. (Required for &Delta;V and &Delta;t calculation)<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
@ -1852,28 +1797,6 @@ sub GasCalculator_Notify($$)
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_LastDV</code> : </li></td><td>Volumenunterschied in der gew&auml;hlten Volumeneinheit zwischen den augenblicklichen und vorherigen Messwert (&Delta;V).<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_LastDt</code> : </li></td><td>Zeitunterschied in Sekunden zwischen den augenblicklichen und vorherigen Messwert (&Delta;t).<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
@ -1907,28 +1830,6 @@ sub GasCalculator_Notify($$)
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_PowerDayCount</code> : </li></td><td>Anzahl der Leistungsmessungen seit Mittenacht. (Wird für Errechnung des t&aumlglichen Mittelwert ben&ouml;tigt)<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_PowerDaySum</code> : </li></td><td>Summe aller Leistungsmessungen seit Mitternacht. (Wird für Errechnung des t&aumlglichen Mittelwert ben&ouml;tigt)<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
@ -1951,17 +1852,6 @@ sub GasCalculator_Notify($$)
</table>
</ul></ul>
<ul><ul>
<table>
<tr>
<td>
<tr><td><li><code>&lt;DestinationDevice&gt;_&lt;SourceCounterReading&gt;_PrevRead</code> : </li></td><td>Reading der vorherigen Messung (Wird für die Berechnung des &Delta;V und &Delta;t ben&ouml;tigt)<BR>
</td></tr>
</td>
</tr>
</table>
</ul></ul>
<ul><ul>
<table>
<tr>