I’d like to track how long my air conditioner has been running since the last cleaning.
To do this, I’ve created a button that is pressed after the cleaning. It stores the timestamp in the state.
Then, I’ve created a history stats entity, that is tracking the relevant climate HVAC states and measures the time. I’ve chosen the following options:
Now, the issue is, that the entity history of the climate (as well as every other entity) is purged after 10 days per default. That leads to the following behavior of the history stats sensor:
The short answer is that you can’t do it with History Stats on its own. History Stats is limited by the Recorder purge limit. There are a few different ways to do something like that with additional core integrations like Utility Meter or Template sensors.
I think the easiest option is the MeasureIt custom integration, which is kind of a combination of History Stats and Utility Meter with some additional features. One of those features is that you can set up the sensor to reset only “manually” instead of based of a time span. Then you can use an automation to reset the sensor, using the measureit.reset action, when your input button is pressed.