Skip to content

Speaker dropdown lists dead entities, and several share a name #7

Description

@WHISTLER-Arc

Greg's Speaker, Vibration sensor and Text to speech dropdowns list every entity in the domain, whether or not it exists any more.

On my own setup that means the Speaker dropdown has 42 entries and 28 of them are unavailable. Worse, a lot of them share a name:

  • "Google Cast" five times, all unavailable
  • "Living Room TV 4K" four times, two of them live
  • "Jan's S22 Ultra" three times, all unavailable
  • the same LG speaker under four different names

Picking the right one is guesswork, and if you pick a dead one Greg goes quiet with nothing to tell you why.

Where it is

_entityOptions(domain) in custom_components/greg/panel/greg-panel.js. It filters hass.states by domain prefix, maps each to its friendly_name or falls back to the entity id, and sorts. No check on availability, and nothing to separate two entities that call themselves the same thing.

Not really Greg's fault, but Greg's problem

The duplicates come from integrations re-registering entities with new unique ids, which leaves the old rows behind in the registry. That is an HA-side thing and I am not going to fix it from here. The _2, _3, _4 suffixes are the giveaway. Worth digging into separately, because 28 dead media players is a mess whatever Greg does about it.

But Greg is where I notice it, and Greg can be better behaved regardless:

  • Drop entities that are unavailable or unknown from the dropdowns, or push them to the bottom under a divider
  • When two entities have the same friendly name, show the entity id as well so you can tell them apart
  • Keep whatever is currently selected in the list even if it has gone unavailable, so opening the settings does not silently change his speaker

Note

Third one matters most. The panel writes back what the dropdown holds, so if a saved speaker vanishes from the list, applying any unrelated setting could quietly move Greg onto a different one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions