History Stats lost after HA upgrade

Hi,

I set up History_stats to track the hours on my HVAC filter but it broke after I updated and restarted HA. It went from correctly showing 16 hours to about 500 hours. Also noticed that the data for the binary sensor that history_stats is tracking has been purged, with only the last few days available. Does history_stats depend on the tracked sensor to stay in the database for at least as long as the start date of the history_stats sensor? I thought this wasn’t the case because there would be some long term statics that would generate automatically. And why is history_stats counting missing data toward the statistic, which is what appears to be happening.

If I change the start date to yesterday (where data is available), history_stats is correct again. My setup:

input_datetime.last_hvac_filter_replacement holds the date of the last filter replacement.

binary_sensor.fan_running turns either on or off depending on if the HVAC fan is running or not.

history_stats is tracking binary_sensor.fan_running from input_datetime.last_hvac_filter_replacement to now().

Bumping for visibility in case anyone knows.