I am trying to setup a History Sensor so that I can monitor how long the heating is on for over the day.
I have added the following but I only seem to get data when state is set to “heat” - However this is just gives a value of 24 hours so assume must be the default state. Does anyone know what the state should be set to to monitor when the heating is on?
History
sensor:
platform: history_stats
name: Heating On Today
entity_id: climate.receiver_1
state: ‘On’
type: time
start: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
end: ‘{{ now() }}’
platform: history_stats
name: Heating On Yesterday
entity_id: climate.receiver_1
state: ‘On’
type: time
end: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
duration:
hours: 24
I’m not sure climate controls have a simple on and off. If you go to developer tools you can find all the states and sensors for the climate entity.
Here is an example of all the values from my Ecobee. My “State” is just heat because I am in heat mode. I would have to build a template sensor for equipment running or something to decipher my climate sensor. I did this with my aux heat so I can track and alert when aux heat is running.
Thanks I checked via Developer tools when heating was on and can see hvac_action was set to ‘heating’
So have amended the config to:
sensor:
platform: history_stats
name: Heating On Today
entity_id: climate.receiver_1
hvac_action: ‘heating’
type: time
start: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
end: ‘{{ now() }}’
platform: history_stats
name: Heating On Yesterday
entity_id: climate.receiver_1
hvac_action: ‘heating’
type: time
end: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
duration:
hours: 24
But get following error:
Invalid config for [sensor.history_stats]: [hvac_action] is an invalid option for [sensor.history_stats]. Check: sensor.history_stats->hvac_action. (See ?, line ?).
Invalid config for [sensor.history_stats]: [hvac_action] is an invalid option for [sensor.history_stats]. Check: sensor.history_stats->hvac_action. (See ?, line ?).