music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.37k stars 52 forks source link

Integration not finding media players due to KeyError: Invalid player_id: #2945

Closed markusg1234 closed 1 month ago

markusg1234 commented 1 month ago

What version of Music Assistant has the issue?

2.2.5

What version of the Home Assistant Integration have you got installed?

2024.9.2

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

When Adding either a google cast or vlc media player a keyerror occurs. This causes no media player to be found in the Music Assistant Integration.

In an earlier version of Music Assistant this problem didn't occur.

How to reproduce

1) Select Home Assistant media players in Music Assistant and save. 2) Error occurs in Music Assistant Log. 3) No media player entities are displayed in the Music Assistant Integration.

Music Providers

RadioBrowser

Player Providers

Google Nest Mini via Google Cast
VLC media player via Telnet

Full log output

logfile.txt

Additional information

No response

What version of Home Assistant Core are your running

2024.9.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Generic x86-64 (e.g. Intel NUC)

josh208 commented 1 month ago

I just want to add that I got the same error (Invalid player_id) with a DLNA mediaplayer, and an ESPHome mediaplayer. In my case I was able to select the mediaplayers in the HA Player Provider config, but then the error was logged and no players were available.

canamman commented 1 month ago

Seeing same issue here " self.mass.config.set_raw_player_config_value( File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/config.py", line 619, in set_raw_player_config_value raise KeyError(msg) KeyError: 'Invalid player_id: media_player.mpd' "

GSVil commented 1 month ago

Rolled back to 2.2.1, this broke somewhere between that and 2.2.5. I skipped a few versions, so can't really say when it broke 😊

jd1 commented 1 month ago

I had a similar issue mashumaro.exceptions.InvalidFieldValue: Field "current_item" of type Optional[QueueItem] in PlayerQueue has invalid value after updating to 2.2.5. Rolling back to 2.2.4 solved it.

falcald commented 1 month ago

Same issue here:


2024-09-22 22:41:50.121 WARNING (MainThread) [music_assistant] Exception in task Task-540 - target: <coroutine object HomeAssistantPlayers.loaded_in_mass at 0x7f7a48bcd0>: 'Invalid player_id: media_player.vlc_telnet'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/hass_players/__init__.py", line 197, in loaded_in_mass
    await self._setup_player(state, entity_registry, device_registry)
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/hass_players/__init__.py", line 417, in _setup_player
    self.mass.config.set_raw_player_config_value(
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/config.py", line 619, in set_raw_player_config_value
    raise KeyError(msg)
KeyError: 'Invalid player_id: media_player.vlc_telnet'
pvodoz commented 1 month ago

Same issue and my logs: 2024-09-21 19:34:55.305 INFO (MainThread) [music_assistant] Loaded player provider Home Assistant MediaPlayers 2024-09-21 19:34:55.336 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/hass_players/init.py", line 197, in loaded_in_mass await self._setup_player(state, entity_registry, device_registry) File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/hass_players/init.py", line 417, in _setup_player self.mass.config.set_raw_player_config_value( File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/config.py", line 619, in set_raw_player_config_value raise KeyError(msg) KeyError: 'Invalid player_id: media_player.salon'

Core 2024.9.2 Supervisor 2024.09.1 Operating System 13.1 Interface utilisateur 20240909.1 Music Assistant Server Current version: 2.2.5 Music Assistant Integration 2024.9.1

shudashov commented 1 month ago

Same issue. My log: 2024-09-22 15:14:51.814 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/hass_players/init.py", line 197, in loaded_in_mass await self._setup_player(state, entity_registry, device_registry) File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/hass_players/init.py", line 417, in _setup_player self.mass.config.set_raw_player_config_value( File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/config.py", line 619, in set_raw_player_config_value raise KeyError(msg) KeyError: 'Invalid player_id: media_player.esp32_speaker_7_esp32_speaker_7' Core 2024.9.2 Supervisor 2024.09.1 Operating System 13.1 Music Assistant Server Current version: 2.2.5 Music Assistant Integration 2024.9.1

maczekg commented 1 month ago

Same issue here. Home Assistant 2024.9.2 / docker Music Assistant Server 2.2.5 / docker MAss integration 2024.9.1. Rolled back to 2.2.4 solved the issue.

marcelveldt commented 1 month ago

This issue should be fixed in the new beta: 2.3.0b27 - if the fix is confirmed working, we'll also roll out a patch release for stable

OzGav commented 1 month ago

This is confirmed fixed.

markusg1234 commented 1 month ago

Thankyou, can also confirm it is now working correctly.

LumCrafter commented 1 month ago

I still seem to be getting the error? KeyError: 'Invalid player_id: media_player.vlc_telnet' Home Assistant 2024.9.3 Music Assistant Server 2.2.5 Mass integration 2024.9.1. Is it because of 2024.9.3?

OzGav commented 1 month ago

@LumCrafter it is fixed in the beta

formatBCE commented 1 month ago

But no patch release for stable? @OzGav

marcelveldt commented 1 month ago

We'll publish a patch for stable soon

formatBCE commented 1 month ago

Love you guys.