After reading the forum, I do not know if I am doing well.
I have this rules which work pretty fine, I get values properly.
rule "Gas Counter" when Item sonoff06 changed to ON then GasHoy.postUpdate((GasHoy.state as Number) + 0.01) GasTot.postUpdate((GasTot.state as Number) + 0.01) end
Set to 0 at midnight the counter. It works fine.
rule "Gas Counter Today set to 0" when Time cron "0 31 12 1/1 * ? *" then GasHoy.postUpdate(0.0) end
Restore values on startup. I do not know if this is well implemented.
rule "RESTART" when System started then GasTot.sendCommand(GasTot.previousState.state) GasHoy.sendCommand(GasHoy.previousState.state) end
The thing is that I do not know if on startup the values will be restore properly. I guess I should test them.
My persistence is
GasTot : strategy = everyMinute, everyDay, restoreOnStartup GasHoy : strategy = everyMinute, everyDay, restoreOnStartup
How I can get the last value stores in the InfluxdB? on startup or even when I restart the rules or items. I have to initialised the Items with a value, and with NULL everything works wrong.