@Linwood wrote:
I have a number of sensors defined as below:
- platform: history_stats name: AC Run Time Today entity_id: sensor.hvac_operating_state state: 'cooling' type: time start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}' end: '{{ now() }}'
These work great for showing today’s cumulative time spent in a particular state.
To use this for long term data though, you have to retain all the detail state data over whatever the period of interest, so if I wanted a year of data to flow to influxdb (or worse stay in HA) I might have dozens of daily data instead of one rolled up number.
Letting recorder record the history_stats derived sensor is worse, as it is calculated continually all day.
What I want is the final number only, essentially on day N, I want to run the calculation one more time for day N-1 and take that (and only that) to influxdb.
Are there any “normal” ways to do this in HA?
The alternative seems to be to schedule some job, either on the HA side to create a rollup entry by direct writes from SQL, or maybe a manual transfer into influxdb of the same sort. But I was hoping for a more “normal” way.
How does one handle long term rollup of data from HA? Not just long term storage, but rolling it up at period end?
Linwood
Posts: 1
Participants: 1