v0.1.42 — lock-in fix for cheapest_charging_window_today
Bug fix: cheapest_charging_window_today lock-in
What was broken
On v0.1.41, when prices were flat (or close to flat) for the rest of the day, the cheapest_charging_window_today sensor moved its state forward by 15 minutes every 15 minutes — at each :00 / :15 / :30 / :45 the picked window was always "starting right now". That made the sensor unusable as a time-trigger: by the time an automation could fire on 18:00, the state had already moved on to 18:15.
What changed
The sensor now locks in the chosen window. Once a 60-minute window is picked, it stays as the sensor state until its end has actually passed — independent of how many quarter-hour boundaries tick by in the meantime.
- State persistence: the locked-in window survives Home Assistant restarts (
RestoreSensor). A previously chosen window is restored as long as its end is still in the future and its start is still today. - After expiry: when the locked window ends, the sensor automatically re-locks the next-cheapest window of the remaining day.
- End of day: once less than 60 min remain today, state is
unknownuntil midnight rolls over.
What you need to do
Nothing — automations that already trigger on the sensor's timestamp will simply start working as documented. The internal QuarterHourUpdateMixin that caused the flicker has been removed; the entity ID, attributes, and device_class: timestamp stay the same.
Full changelog
See CHANGELOG.md.