History Stats Does Not Update Until HA Restarted

Hi there,

I have a “history stats” sensor that has been working for months, that all of a sudden stopped working. I’m curious if anyone has had this happen to them recently. I am trying to figure out if it is user error (my issue) or a bug in the current HA core.

The sensor tracks how long my baby has napped today:

  - platform: history_stats
    name: Ethan nap duration today
    entity_id: input_boolean.napping
    state: "on"
    type: time
    start: "{{ now().replace(hour=1, minute=0, second=0, microsecond=0) }}"
    end: "{{ now() }}"

The napping boolean was on for about 3 hours today:

But the value is 0:

Note: I have also seen the value not getting updated often, and then when we turn off napping all of a sudden it jumps.

(Note, at the time that the screenshots were taken above, it is 2:30 PM local time.)

Thanks!
Matt

Ah wow, restarting Home Assistant results In the proper value being shown. So it sounds like it is tracking it properly, it just doesn’t update.