I do something similar, you should be able to figure this out -
I use history stats sensors to track how much the heating and hot water are “on”.
- platform: history_stats
name: heating hours
entity_id: sensor.wiser_heating
state: "On"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
- platform: history_stats
name: hot water hours
entity_id: sensor.wiser_hot_water
state: "On"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
- platform: history_stats
name: Boiler firing hours today
entity_id: sensor.boiler_firing
state: "On"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
I also have a “boiler firing” template sensor, which is “On” if either of the water or heating sensors are on. As already commented, this doesn’t actually correspond exactly to when the boiler is actually lit up, but it’s good enough for me.
You could similarly set up template sensors to extract the hvac_action attribute of the various wiser climate sensors, and then history stats sensors to track when those template sensors are “heating”. (You could also use the is_heating attribute I think, which is true or false, but from digging around ages ago in to what happened when a stat was calling for heat, I used the hvac_action, it seems to switch between “idle” and “heating”. I don’t track the hours, but I do have stuff that determines which rooms are calling for heat by using this attribute).
You can set up the template sensor very easily using a helper - go to settings, Devices and services, click the helpers tab, create helper button bottom right, choose “template”, choose “template a sensor”, and fill it in like I have here - I chose the name to “Lounge stat demand”, call them what you like.
Then set up a history_stats helper to track when that has state “heating” (it shows “idle” in my pic), with start and end set as I show in my examples above, and you should get a sensor that gives how long that sensor has been in state “heating”, which resets each day. When setting up a history stats helper, the start and end fields are on the second screen after you click next.