mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
73_GasCalculator: bugfix: Corrected month of annual reading
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@12848 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b9904a742e
commit
fbc115fc58
@ -553,6 +553,9 @@ sub GasCalculator_Notify($$)
|
|||||||
my $GasCountReadingTimestampCurrentRelative = time_str2num($GasCountReadingTimestampCurrent);
|
my $GasCountReadingTimestampCurrentRelative = time_str2num($GasCountReadingTimestampCurrent);
|
||||||
my($GasCountReadingTimestampCurrentSec,$GasCountReadingTimestampCurrentMin,$GasCountReadingTimestampCurrentHour,$GasCountReadingTimestampCurrentMday,$GasCountReadingTimestampCurrentMon,$GasCountReadingTimestampCurrentYear,$GasCountReadingTimestampCurrentWday,$GasCountReadingTimestampCurrentYday,$GasCountReadingTimestampCurrentIsdst) = localtime($GasCountReadingTimestampCurrentRelative);
|
my($GasCountReadingTimestampCurrentSec,$GasCountReadingTimestampCurrentMin,$GasCountReadingTimestampCurrentHour,$GasCountReadingTimestampCurrentMday,$GasCountReadingTimestampCurrentMon,$GasCountReadingTimestampCurrentYear,$GasCountReadingTimestampCurrentWday,$GasCountReadingTimestampCurrentYday,$GasCountReadingTimestampCurrentIsdst) = localtime($GasCountReadingTimestampCurrentRelative);
|
||||||
|
|
||||||
|
### Correct current month by one month since Unix/Linux start January with 0 instead of 1
|
||||||
|
$GasCountReadingTimestampCurrentMon = $GasCountReadingTimestampCurrentMon + 1;
|
||||||
|
|
||||||
### Create Log entries for debugging
|
### Create Log entries for debugging
|
||||||
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Reading Name : " . $GasCountReadingName;
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Reading Name : " . $GasCountReadingName;
|
||||||
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous Reading Value : " . $GasCountReadingTimestampPrevious;
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Previous Reading Value : " . $GasCountReadingTimestampPrevious;
|
||||||
@ -689,13 +692,13 @@ sub GasCalculator_Notify($$)
|
|||||||
|
|
||||||
### Calculate the payment month since the year of gas meter reading started
|
### Calculate the payment month since the year of gas meter reading started
|
||||||
my $GasCalcMeterYearMonth=0;
|
my $GasCalcMeterYearMonth=0;
|
||||||
if (($GasCountReadingTimestampCurrentMon + 1 - $attr{$GasCalcName}{MonthOfAnnualReading} + 1) < 1)
|
if (($GasCountReadingTimestampCurrentMon - $attr{$GasCalcName}{MonthOfAnnualReading} + 1) < 1)
|
||||||
{
|
{
|
||||||
$GasCalcMeterYearMonth = 12 + $GasCountReadingTimestampCurrentMon + 1 - $attr{$GasCalcName}{MonthOfAnnualReading} + 1;
|
$GasCalcMeterYearMonth = 12 + $GasCountReadingTimestampCurrentMon - $attr{$GasCalcName}{MonthOfAnnualReading};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$GasCalcMeterYearMonth = $GasCountReadingTimestampCurrentMon + 1 - $attr{$GasCalcName}{MonthOfAnnualReading} + 1;
|
$GasCalcMeterYearMonth = 1 + $GasCountReadingTimestampCurrentMon - $attr{$GasCalcName}{MonthOfAnnualReading};
|
||||||
}
|
}
|
||||||
|
|
||||||
### Calculate reserves at gas provider based on monthly advance payments within year of gas meter reading
|
### Calculate reserves at gas provider based on monthly advance payments within year of gas meter reading
|
||||||
@ -710,6 +713,7 @@ sub GasCalculator_Notify($$)
|
|||||||
|
|
||||||
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - _______Times__________________________________________";
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - _______Times__________________________________________";
|
||||||
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - GasCalcMeterYearMonth : " . $GasCalcMeterYearMonth;
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - GasCalcMeterYearMonth : " . $GasCalcMeterYearMonth;
|
||||||
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - Current Month : " . $GasCountReadingTimestampCurrentMon;
|
||||||
|
|
||||||
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - _______Energy_________________________________________";
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - _______Energy_________________________________________";
|
||||||
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - GasCalcEnergyDay : " . sprintf('%.3f', ($GasCalcEnergyDay)) . " kWh";
|
Log3 $GasCalcName, 5, $GasCalcName. " : GasCalculator - GasCalcEnergyDay : " . sprintf('%.3f', ($GasCalcEnergyDay)) . " kWh";
|
||||||
@ -795,6 +799,9 @@ sub GasCalculator_Notify($$)
|
|||||||
### Write reserves at gas provider based on monthly advance payments within year of gas meter reading
|
### Write reserves at gas provider based on monthly advance payments within year of gas meter reading
|
||||||
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_FinanceReserve", sprintf('%.3f', ($GasCalcReserves)));
|
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_FinanceReserve", sprintf('%.3f', ($GasCalcReserves)));
|
||||||
|
|
||||||
|
### Write months since last meter reading
|
||||||
|
readingsBulkUpdate($GasCalcReadingDestinationDevice, $GasCalcReadingPrefix . "_MonthMeterReading", sprintf('%.0f', ($GasCalcMeterYearMonth)));
|
||||||
|
|
||||||
### Finish and execute Bulkupdate
|
### Finish and execute Bulkupdate
|
||||||
readingsEndUpdate($GasCalcReadingDestinationDevice, 1);
|
readingsEndUpdate($GasCalcReadingDestinationDevice, 1);
|
||||||
}
|
}
|
||||||
@ -1246,6 +1253,17 @@ sub GasCalculator_Notify($$)
|
|||||||
</table>
|
</table>
|
||||||
</ul></ul>
|
</ul></ul>
|
||||||
|
|
||||||
|
<ul><ul>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<tr><td><li><code><DestinationDevice>_<SourceCounterReading>_MonthMeterReading</code> : </li></td><td>Number of month since last meter reading. The month when the reading occured is the first month = 1.<BR>
|
||||||
|
</td></tr>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</ul></ul>
|
||||||
|
|
||||||
<ul><ul>
|
<ul><ul>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@ -1809,6 +1827,17 @@ sub GasCalculator_Notify($$)
|
|||||||
</table>
|
</table>
|
||||||
</ul></ul>
|
</ul></ul>
|
||||||
|
|
||||||
|
<ul><ul>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<tr><td><li><code><DestinationDevice>_<SourceCounterReading>_MonthMeterReading</code> : </li></td><td>Anzahl der Monate seit der letzten Zählerablesung. Der Monat der Zählerablesung ist der erste Monat = 1.<BR>
|
||||||
|
</td></tr>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</ul></ul>
|
||||||
|
|
||||||
<ul><ul>
|
<ul><ul>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user