Store state last seen time separately #18806
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Follow up to #17270
After sleeping on it for a bit, I'm worried about using the
last_updated
time to expire old states. If hass is running for a long period of time, and an entity is only updated very infrequently, the state might be dropped unintentionally. For example, an input boolean might not ever be touched while hass is running. This PR adds a wrapping object around the stored state so that we can record the actual last time this state was active in hass.