From ba551e3fc876f4de014e200427c416282a7b90e2 Mon Sep 17 00:00:00 2001 From: sailor-fhem <> Date: Mon, 25 Jan 2016 09:15:49 +0000 Subject: [PATCH] 73_GasCalculator : bugfix in commandref and attribute renamed. git-svn-id: https://svn.fhem.de/fhem/trunk@10618 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/73_GasCalculator.pm | 47 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/fhem/FHEM/73_GasCalculator.pm b/fhem/FHEM/73_GasCalculator.pm index 58bf3486f..6e3e8e5da 100644 --- a/fhem/FHEM/73_GasCalculator.pm +++ b/fhem/FHEM/73_GasCalculator.pm @@ -45,6 +45,7 @@ # X0006 21.01.2016 Sailor =pod Description updated with description for the readings # 10588 22.01.2016 Sailor Comments First check-in # 10590 22.01.2016 Sailor Define Deleting version code from define +# 10591 22.01.2016 Sailor =pod Spelling mistakes corrected ######################################################################################################################## @@ -73,11 +74,11 @@ sub GasCalculator_Initialize($) $hash->{AttrList} = "disable:0,1 " . "GasCounterOffset " . - "GasCountsPerCubic " . + "GasCubicPerCounts " . "GaszValue " . "GasNominalHeatingValue " . "BasicPricePerAnnum " . - "GasPricePerCubic " . + "GasPricePerKWh " . "MonthlyPayment " . "MonthOfAnnualReading " . "ReadingDestination:CalculatorDevice,CounterDevice " . @@ -86,7 +87,7 @@ sub GasCalculator_Initialize($) } ####END####### Initialize module ###############################################################################END##### -###START###### Activate module after module has been used via fhem command "define" ##########################START#### +###START###### Activate module after module has been used via fhem command "define" ##########################START#### sub GasCalculator_Define($$$) { my ($hash, $def) = @_; @@ -190,13 +191,13 @@ sub GasCalculator_Notify($$) ### Writing log entry Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - The attribute GasCounterOffset was missing and has been set to 0"; } - if(!defined($attr{$GasCalcName}{GasCountsPerCubic})) + if(!defined($attr{$GasCalcName}{GasCubicPerCounts})) { ### Set attribute with standard value since it is not available - $attr{$GasCalcName}{GasCountsPerCubic} = 0.01; + $attr{$GasCalcName}{GasCubicPerCounts} = 0.01; ### Writing log entry - Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - The attribute GasCountsPerCubic was missing and has been set to 0.01 counts/voulume-unit"; + Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - The attribute GasCubicPerCounts was missing and has been set to 0.01 counts/voulume-unit"; } if(!defined($attr{$GasCalcName}{GasNominalHeatingValue})) @@ -207,13 +208,13 @@ sub GasCalculator_Notify($$) ### Writing log entry Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - The attribute GasNominalHeatingValue was missing and has been set to 10 kWh/volume-unit"; } - if(!defined($attr{$GasCalcName}{GasPricePerCubic})) + if(!defined($attr{$GasCalcName}{GasPricePerKWh})) { ### Set attribute with standard value since it is not available - $attr{$GasCalcName}{GasPricePerCubic} = 0.0654; + $attr{$GasCalcName}{GasPricePerKWh} = 0.0654; ### Writing log entry - Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - The attribute GasPricePerCubic was missing and has been set to 0.0654 currency-unit/volume-unit"; + Log3 $GasCalcName, 3, $GasCalcName. " : GasCalculator - The attribute GasPricePerKWh was missing and has been set to 0.0654 currency-unit/volume-unit"; } if(!defined($attr{$GasCalcName}{GaszValue})) { @@ -320,7 +321,7 @@ sub GasCalculator_Notify($$) } ###Get current Counter and transform in Volume (cubic) as read on mechanic gas meter - $GasCountReadingValueCurrent = $1 * $attr{$GasCalcName}{GasCountsPerCubic} + $attr{$GasCalcName}{GasCounterOffset}; + $GasCountReadingValueCurrent = $1 * $attr{$GasCalcName}{GasCubicPerCounts} + $attr{$GasCalcName}{GasCounterOffset}; my $GasCountReadingTimestampCurrent = ReadingsTimestamp($GasCountName,$GasCountReadingName,0); @@ -526,13 +527,13 @@ sub GasCalculator_Notify($$) my $GasCalcEnergyMeter = ($GasCountReadingValueCurrent - ReadingsVal($GasCalcReadingDestinationDeviceName, $GasCalcReadingPrefix . "_Vol1stMeter", "0")) * $attr{$GasCalcName}{GaszValue} * $attr{$GasCalcName}{GasNominalHeatingValue}; ### Calculate pure gas cost since first day of month - my $GasCalcEnergyCostMonth = $GasCalcEnergyMonth * $attr{$GasCalcName}{GasPricePerCubic}; + my $GasCalcEnergyCostMonth = $GasCalcEnergyMonth * $attr{$GasCalcName}{GasPricePerKWh}; ### Calculate pure gas cost since first day of calendar year - my $GasCalcEnergyCostYear = $GasCalcEnergyYear * $attr{$GasCalcName}{GasPricePerCubic}; + my $GasCalcEnergyCostYear = $GasCalcEnergyYear * $attr{$GasCalcName}{GasPricePerKWh}; ### Calculate pure gas cost since first day of gas meter reading year - my $GasCalcEnergyCostMeter = $GasCalcEnergyMeter * $attr{$GasCalcName}{GasPricePerCubic}; + my $GasCalcEnergyCostMeter = $GasCalcEnergyMeter * $attr{$GasCalcName}{GasPricePerKWh}; ### Calculate the payment month since the year of gas meter reading started my $GasCalcMeterYearMonth=0; @@ -656,7 +657,7 @@ sub GasCalculator_Notify($$) ###START###### Description for fhem commandref ################################################################START#### =pod -=item device +=item helper =begin html @@ -816,8 +817,8 @@ sub GasCalculator_Notify($$)
- | |
GasCountsPerCubic : | A valid float number of the ammount of volume per ticks. - The value is given by the mechanical trigger of the mechanical gas meter. E.g. GasCountsPerCubic = 0.01 means each count is a hundredth of the volume basis unit. + |
GasCubicPerCounts : | A valid float number of the ammount of volume per ticks. + The value is given by the mechanical trigger of the mechanical gas meter. E.g. GasCubicPerCounts = 0.01 means each count is a hundredth of the volume basis unit. The default value is 0.01 |
- | |
GaszValue : | A valid float number for the gas condition based on the local installation of the mechganical gas meter in relation of the gas providers main supply station. + |
GaszValue : | A valid float number for the gas condition based on the local installation of the mechanical gas meter in relation of the gas providers main supply station. The value is provided by your local gas provider is shown on your gas bill. The default value is 1.00 |
- | |
GasPricePerCubic : | A valid float number for gas price in the chosen currency per chosen volume for the gas. + |
GasPricePerKWh : | A valid float number for gas price in the chosen currency per kWh for the gas. The value is provided by your local gas provider is shown on your gas bill. The default value is 0.0654 |
Das GasCalculator Modul berechnet den Gas - Verbrauch und den verbundenen Kosten von einem oder mehreren Gas-Zählern. - Es ist kein eigenes Zählermodul sondern benötigt eine Regular Expression (regex or regexp) um das Reading mit den Zähl-Impulse von einem oder mehreren Gaszählern zu finden. + Es ist kein eigenes Zählermodul sondern benötigt eine Regular Expression (regex or regexp) um das Reading mit den Zähl-Impulse von einem oder mehreren Gaszählern zu finden. Sobald das Modul in der fhem.cfg definiert wurde, reagiert das Modul auf jedes durch das regex definierte event wie beispielsweise ein myOWDEVICE:counter.* etc. @@ -1274,7 +1275,7 @@ sub GasCalculator_Notify($$) | |
- Zusätzlich k&aouml;nnen die globalen Attribute wie room verwendet werden. + Zusätzlich können die globalen Attribute wie room verwendet werden. |
- | |
GasCountsPerCubic : | Eine gültige float-Zahl für die Menge an Zählimpulsen pro gewählter Volumen-Grundeinheit. - Der Wert ist durch das mechanische Zählwerk des Gaszählers vorgegeben. GasCountsPerCubic = 0.01 bedeutet, dass jeder Zählimpuls ein hunderstel der gewählten Volumengrundeinheit. + |
GasCubicPerCounts : | Eine gültige float-Zahl für die Menge an Zählimpulsen pro gewählter Volumen-Grundeinheit. + Der Wert ist durch das mechanische Zählwerk des Gaszählers vorgegeben. GasCubicPerCounts = 0.01 bedeutet, dass jeder Zählimpuls ein hunderstel der gewählten Volumengrundeinheit. Der Standard-Wert ist 0.01 |
- | |
GasPricePerCubic : | Eine gültige float-Zahl für den Gas Preis in der gewählten Währung pro gewähltem Volumen. + |
GasPricePerKWh : | Eine gültige float-Zahl für den Gas Preis in der gewählten Währung pro kWh. Dieser Wert stammt vom Gas-Zulieferer und steht auf der Gas-Rechnung. Der Standard-Wert ist 0.0654 |