What im trying to achieve:
Id like a sensor that tracks how long my heating has been on over the month so i can create an automation to send me a notification saying how much its been on. Possibly also detailing the difference from the previous month.
My setup:
Ive got a Sonoff Basic acting as a relay to turn the boiler on. This is controlled by 2 virtual thermostats in Home Assistant which are scheduled using Schedy.
Thoughts so far:
I came across the Utility Meter integration which im wondering would work with a history stats sensor to record the time the heating switch has been on for over a month period. This is what im thinking for the YAML-
sensor:
- platform: history_stats
name: Heating ON today
entity_id: switch.heating
state: 'on'
type: time
end: '{{ now().replace(hour=0, minute=0, second=0) }}'
duration:
hours: 24
utility_meter:
heating_usage:
source: sensor.heating_on_today
cycle: monthly
As far as i can see this should work but im a little unsure as to how the Utility Meter works. Concerns i have are whether the utility meter sensor will reset if the history stats sensor is reset (for example on home assistant restart). Ive also set the history stats sensor to only record for 24 hours in the hope that when the sensor starts counting the next day, the utility sensor will just add the number to the total from the previous days.
So will this work? Or am i completely barking up the wrong tree! Any suggestions welcome!