I want to calculate the power usage of an appliance based on how long it is turned on for in a nominal period (let’s say the last 24 hours). The appliance in question has a constant power draw of 500W.
The best way I can think of to do this is to update a number item every minute based on the on state of the appliance. In this case the item will have value 0 if the appliance is off and 500 if it is on. I would then use sumSince to calculate the power usage in ‘watt-minutes’. Dividing by 60 would give me the watt-hour value.
The downsides of this approach are:
- Requires me to persist power data for each appliance on a minute by minute basis
- Not very granular - if the state changes within a minute then this will not be reflected.
If I could work out the total ON time of the appliance over my time range, then calculating the power usage should be trivial, but I can’t see how to do this from the persistence extensions.
Anyone have any ideas?