Hello Community,
i use openHAB2 since two months now and i´m very happy with it. Never used openHAB1 or any other smarthome server before. It´s my first contact to a smarthome
I have some HomeMatic energy switches running that collect my used energy. Now i would like to calculate the daily / montly / year costs for it. The problem is to get JUST the daily costs in my eyes.
My current rule use only the Total-used-energy value and multiple them via my energycosts per kWh.
This works fine but it is not a very meaningful after some days because it grows and grows
Here is my current rule for the total costs:
import org.openhab.core.library.types.*
var Number Var_WH
// Energy Costs
var Number AUEW_KWH=0.30
// Wh to KWh
rule "Calculate KWh"
when
Item KL_Stromzaehler_EnergyCount changed
then
Var_WH = KL_Stromzaehler_EnergyCount.state
var Number Var_KWH = Var_WH / 1000
Strom_Gesamtverbrauch_KWH.postUpdate(Var_KWH)
end
rule "Calculate Energy Costs"
when
Item Strom_Gesamtverbrauch_KWH changed
then
var Number Var_KWH = Strom_Gesamtverbrauch_KWH.state
var Number Kosten = Var_KWH * AUEW_KWH
Strom_Summe.postUpdate(Kosten)
end
I found a thread about the same topic ( with “delta.since” ) but i don´t understand it.
How can i calculate the daily costs with a rule ?
Thanks for any help!