I'm trying to add the Energy attribute to devices that offer power monitoring to get an idea of what their total consumption was.
So far my idea for the approach was to store the previously reported power and when it changes, use the previous value and the time difference to set the added energy. Then add a RM like this:
It may need some more complicated logic. Sample scenario: there was a constant power consumption of 1000 watts for 60 minutes, then the plug is switched off and it’s last report is 0 watts. The expected Energy consumption calculation is 1 kW/h
It uses the previously reported value to calculate, and updates it for the next report.
The only hiccup I have discovered so far is that I need power reports to come in more often for the calculation to be precise, but it would spam the network and I don't want that.
Still testing to see if anything better comes to mind, maybe I can use an App to handle this instead of the RM part. WIP...