home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.89k stars 30.96k forks source link

Yamaha Integration Has Unstable Entity IDs #127747

Open codahq opened 1 month ago

codahq commented 1 month ago

The problem

The Yamaha integration creates entity IDs based on the "Name" value in the yaml. For example, if the yaml looks like this:

- platform: yamaha
  host: 10.10.1.149
  name: "Theater Yamaha"
  zone_names:
    Main_Zone: "Receiver"

This creates a media player entity like this:

media_player.theater_yamaha

Unfortunately, if the device is turned on when Home Assistant restarts then the Yamaha integration appears to tacks on the area where the device resides resulting in:

media_player.theater_yamaha_theater

Additionally, I have noticed that if I set the zone name it will take the zone name instead when Home Assistant is restarted and the device is on resulting in:

media_player.theater_yamaha_receiver

This is a horrible experience to keep dashboards and automations working. I have three Yamaha receivers and the IDs are always jumping between these values.

for my family room device

media_player.family_room_yamaha media_player.family_room_yamaha_family_room media_player.family_room_yamaha_receiver

for my theater device

media_player.theater_yamaha media_player.theater_yamaha_theater media_player.theater_yamaha_receiver

for my gym device

media_player.gym_yamaha media_player.gym_yamaha_gym media_player.gym_yamaha_receiver

Please make it so we can define the uniqueid in the yaml. If that is not possible for whatever reason make it so it will definitively take "Name".yamilize() + "" + "Zone Name".yamilize() or just "Name".yamilize(). The flip flopping around is not working.

What version of Home Assistant Core has the issue?

core-2024.10.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Yamaha

Link to integration documentation on our website

https://www.home-assistant.io/integrations/yamaha/

Diagnostics information

No response

Example YAML snippet

#family room
- platform: yamaha
  host: 10.10.1.149
  name: "Family Room Yamaha"
  source_ignore:
    - "AV1"
    - "AV2"
    - "AV3"
    - "AV4"
    - "AV5"
    - "AV6"
    - "AirPlay"
    - "NET RADIO"
    - "Pandora"
    - "Rhapsody"
    - "SERVER"
    - "SiriusXM"
    - "Spotify"
    - "TUNER"
    - "USB"
    - "iPod (USB)"
    - "AUX"
    - "V-AUX"
    - "HDMI3"
    - "HDMI4"
    - "HDMI5"
    - "HDMI6"
    - "AUDIO2"
  source_names:
    HDMI1: "Nvidia Shield"
    HDMI2: "PlayStation 3"
    AUDIO1: "Chromecast Audio"
  zone_ignore:
    - "Zone_2"
  zone_names:
    Main_Zone: "Receiver"
#theater
- platform: yamaha
  host: 10.10.1.147
  name: "Theater Yamaha"
  source_ignore:
    - "AV1"
    - "AV2"
    - "AV3"
    - "AV4"
    - "AV5"
    - "AV6"
    - "AirPlay"
    - "NET RADIO"
    - "Pandora"
    - "Rhapsody"
    - "SERVER"
    - "SiriusXM"
    - "Spotify"
    - "TUNER"
    - "USB"
    - "iPod (USB)"
    - "AUX"
    - "V-AUX"
    - "HDMI4"
    - "HDMI5"
    - "HDMI6"
    - "AUDIO2"
  source_names:
    HDMI1: "Blu-ray"
    HDMI2: "Nvidia Shield"
    HDMI3: "Nintendo Switch"
    AUDIO1: "Chromecast Audio"
  zone_ignore:
    - "Zone_2"
  zone_names:
    Main_Zone: "Receiver"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

yamaha documentation yamaha source