#Find time windows when entity equals a specific state

1 messages · Page 1 of 1 (latest)

hasty veldt
#

I’m trying to work out, in Home Assistant, the time intervals when an entity (e.g. climate.living_room) had a certain state such as "heating".

I don’t want the total duration or proportion of time — I want the actual start and end timestamps of each “heating” period within a time window.

The get_statistics and history_stats integrations only give aggregate values, and templates can only access the current state duration.

The reason I want access to this data is because I'm trying to design a community blueprint that helps you to calculate the heat loss of your home. But in order to do that, I need to estimate whether gas consumption (for which I use get_statistics) is coming from heating or from hot water use.

Any pointers or examples would be much appreciated.

cyan wyvern
#

I use a trigger-based template sensor to calculate the heating or cooling rate of my A/C and furnace so that I can be alerted if it isn’t heating or cooling as quickly as it should.

The rate is calculated by a single template sensor; it triggers once when heating turns on and stores the temperature and timestamp in attributes. Then it triggers when heating turns off and calculates the duration it was on for, and the temperature change, and calculates the rate.

hasty veldt