Locking the entity_id

Hi. I have discovery enabled and a few Roku and Sonos devices. I also use Plex on the Roku.

One of my Sonos speakers is called Living Room and so is the Plex.

The entity_id of these devices changes sometimes from reboot.

For example, right now my Sonos speaker in living room is called media_player.living_room and my Plex is called media_player.living_room_2

But this wasn’t the case yesterday, the Sonos was living_room_2.

I’d like to ensure the Sonos speaker doesn’t change. Is there a way to do this? Thank you!

I don’t use plex or sonos but I have two ATVs. In the setting of the ATV, I can call them as I like which HA uses when discovered.

I am guessing they are being discovered and assigned identical media names then HASS is appending the numbers to keep them unique. They probably change depending on which is discovered first which will vary each time.

Try changing your sonos to “living room sonos” or something in the sonus app, then they would be distinct.

1 Like

Yes, this is what appears to be happening. I’ll adjust the device names to keep them unique and use customize to adjust the friendly name. Thank you.

1 Like

It seems entity_namespace helps also. I added the last line and media_player.living_room becomes media_player.sonos_living_room :slight_smile:

  - platform: sonos
    hosts:
      - !secret bedroom_sonos
      - !secret kitchen_sonos
      - !secret bathroom_sonos
      - !secret living_room_sonos
    entity_namespace: 'sonos'
1 Like