I don´t like to spam my openhab with a Time cron job every second so I´m trying to find a better solution and give your suggestion a try. Anyhow the kwH values we´re pretty accurate after a whole day. I checked it against my Fusion Solar app of my inverter.
I´m struggeling with getting a timestamp from my Huawei_Grid item and compare it with the next timestamp update from the same item.
How to do this? I didn´t find any solutions for me that fits…this is the code i´m having so far (I know it´s not much…):
rule "calculate energy"
Item Huawei_Grid changed
var update = Huawei_Grid.lastUpdate()
How to get two lastUpdates status from the same item and how to calculate with TimeDate variables?
There is no kWh-reading from your smart meter available? that would be the goto-version. Converting kW/interval is prone for errors like if you miss a beat or similar you won’t get the exact kWh out of it. If you’ve really only got kW-readings, you can go the linked route.
That’s one issue, if you only have kW delivered. You can either assume there’s a strict 5second interval and just use the delta between two item states and hope for the best.
or you can read out the timestamps like this and still hope for the