Skip to content

Don't bring entity states back after the collection is torn down - #825

Merged
frenck merged 1 commit into
masterfrom
claude/entity-states-after-teardown
Dec 4, 2026
Merged

frenck merged 1 commit into
masterfrom
claude/entity-states-after-teardown

Conversation

@bramkragten

Copy link
Copy Markdown
Member

When the entity states collection is torn down it clears its store and unsubscribes, but the callback stays registered until Home Assistant confirms the unsubscribe. A message that came in meanwhile was applied to an empty map and published, so the cleared store held a few entities again, and the next subscriber got those before its own snapshot arrived.

The callback now ignores incremental messages once the store was cleared, like the services and config collections already do. A new subscription still starts from its snapshot. #823 already stopped messages that only change or remove entities from doing this, this covers the ones that add entities. Tests cover it with and without batchUpdates.

🤖 Generated with Claude Code

The subscription callback stays registered until Home Assistant confirms
the unsubscribe. A message that came in meanwhile was applied to an empty
map and published, so the cleared store held a few entities again.
Incremental messages are now ignored once the store was cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@frenck
frenck merged commit d325091 into master Dec 4, 2026
2 checks passed
@frenck
frenck deleted the claude/entity-states-after-teardown branch December 4, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants