Repository navigation
Pick up a media player renamed in Home Assistant - #8
Merged
Merged
Conversation
evski
reviewed
Nov 4, 2026
evski
left a comment
Owner
There was a problem hiding this comment.
Thanks @OpenDeernet, nice catch and a clear write-up. The fix is tight and keeps the cheap path for big installs, and the new test covers it. CI is green on Node 20 and 22, so merging. I'll ship it in a patch release shortly. (Heads-up: I maintain this with an AI assistant's help.)
Owner
|
Released in v1.1.1. HACS should offer the update shortly. Thanks again! |
Contributor
Author
|
Thanks a lot for merging this and for the kind words! |
Owner
|
You're welcome — glad it's useful day to day. Appreciate you taking the time to dig into the rename case and send a clean fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this change?
When a media player is renamed in Home Assistant (say
media_player.kitchen->media_player.kitchen_speaker), it vanishes from the sidebar until the page is reloaded.mediaPlayerIds()only re-lists the entity ids when the number of entities changes. A rename removes one id and adds another in the same update, so the count stays the same, the cache keeps the old id,hass.states[oldId]is now undefined and the new id is never seen. The fix also re-lists when one of the cached ids is no longer inhass.states. It's a quick check over the handful of cached media players, so the cheap path for large installs stays the same.How was it tested?
npm testpasses (added a "V3 renamed entity" check: it fails onmainwithOffice, minis=3and passes with the fix)Checklist
CHANGELOG.mdupdated under Unreleased