History_stats Showing Zero Even Though Entity Changes

I have a history_stats definition which shows me how long my boiler burner was “on” (total runtime) yesterday:

  - platform: history_stats
    name: Burner on yesterday
    unique_id: burner_on_yesterday
    entity_id: binary_sensor.hvacesp_boiler_burner
    state: 'on'
    type: time
    end: '{{ today_at() }}'
    duration:
      hours: 24

This has been working for years, but ever since updating to 2025.5.3, it always remains at zero.

I confirmed that the entity binary_sensor.hvacesp_boiler_burner is updating (chaging between “off” and “on”) regularly as before.

I have a similar definition for today’s runtime, which still works normally:

  - platform: history_stats
    name: Burner on today
    unique_id: burner_on_today
    entity_id: binary_sensor.hvacesp_boiler_burner
    state: 'on'
    type: time
    start: '{{ today_at() }}'
    end: '{{ now() }}'

I’m stumped. Which usually means it’ll be something very obvious that I’m missing.

Any ideas?

Looks alright to me, only thing that differs with mine is that I use double quotes…

The plot thickens. This is still happening, but I’ve been able to confirm that:

  1. If I create a new history_stats via the UI, exactly like the above, it still doesn’t update.
  2. If I create a new history_stats in configuration.yaml, changing only the name, it still doesn’t update.
  3. If I use Developer Tools/YAML to “reload” the “History Stats Entities,” the two YAML-defined entities suddenly have the correct values (total run time from the previous day.) But the one created via the UI still shows zero.
  4. If I restart HA, all three entities suddenly have the correct values.

So, I’ve ruled a couple of things out. It’s not that the database is missing the data. It’s not that my definitions are wrong.

I’m open to suggestions on what to try next.

Only thing you can do is wait for the next release (or switch to beta). It’s a known bug. Regression in history_stats sliding time window where end: is prior to now() caused by #143279 · Issue #145112 · home-assistant/core · GitHub

1 Like

Thank you! I was beginning to think I was going crazy.

1 Like

For anyone else experiencing this, it looks like it’s been merged into version 2025.5.3: