I created some rules today to monitor my gas consumption.
I use Homematic HM-ES-TX-WM and the corresponding dongle attached to my gas meter to read gas consumption.
HM-ES-TX-WM delivers a cumulative counter of gas consumed as m3.
I had the idea to create a rule which would make rolling consumption values for 1h, 24h, and 30d.
The commutative value counter is initialized with 0 before receiving the actual values from the gas meter.
Here is the Influxdb query result:
InfluxDB shell version: 1.8.10
> select * from GasCounterCum
name: GasCounterCum
time item value
---- ---- -----
2022-11-14T13:59:00.395Z GasCounterCum 0
2022-11-14T14:00:00.412Z GasCounterCum 5460.14013672
2022-11-14T14:00:00.94Z GasCounterCum 5460.14013672
2022-11-14T14:05:00.943Z GasCounterCum 5460.14013672
2022-11-14T14:10:00.954Z GasCounterCum 5460.14013672
2022-11-14T14:15:00.964Z GasCounterCum 5460.14013672
..........
2022-11-14T17:06:00.346Z GasCounterCum 5460.18017578
2022-11-14T17:08:00.352Z GasCounterCum 5460.24023438
2022-11-14T17:10:00.939Z GasCounterCum 5460.24023438
2022-11-14T17:11:00.352Z GasCounterCum 5460.29980469
2022-11-14T17:14:00.529Z GasCounterCum 5460.33984375
2022-11-14T17:15:00.952Z GasCounterCum 5460.33984375
2022-11-14T17:16:00.356Z GasCounterCum 5460.37011719
2022-11-14T17:20:00.942Z GasCounterCum 5460.37011719
2022-11-14T17:25:00.941Z GasCounterCum 5460.37011719
2022-11-14T17:30:00.941Z GasCounterCum 5460.37011719
2022-11-14T17:35:00.951Z GasCounterCum 5460.37011719
2022-11-14T17:40:00.941Z GasCounterCum 5460.37011719
I would expect when using PersistenceExtensions.deltaSince with an interval back beyond the time stamp of the 0 value at (2022-11-14T13:59:00.395Z) to get some value different than 0.
this instruction gives me back a value 0:
last24h = PersistenceExtensions.deltaSince(ir.getItem("GasCounterCum"), ZonedDateTime.now().minusHours(24)).floatValue()
Once the rolling window does not go beyond the 0 initial value, e.g the 1h rolling window deltaSince gives the right values back.
Here is the example output of the 1h values, 24h and 30d are zero:
Is there an option which I missed here?