B5r1oJ0A9G/teufel_raumfeld

Plugin fails to work if speakers/groups are in Spotify Mode

Opened this issue · 0 comments

The plugin seems to to be able to handle if the speakers/groups are currently in "Spotify" Mode. They can be in this mode because either spotify is currently streaming to them or if this was the last source for the speakers (even days ago)

How to reproduce:

  • Use the Spotify App on any of your devices and play some song on the Raumfeld speakers

Whats Working:

  • The Prev, Next and Pause Buttons on the HA Mediaplayer for the Raumfeld Group work perfectly and switch songs in Spotify. Good!
  • If you click on the "Browse Media" Button on the HA Mediaplayer for the Raumfeld Group you see your Media Library from Raumfeld. Good!

Check the Mediaplayer in Homeassistant and notice:

  • The Currently Playing title on the HA Mediaplayer for the Group is wrong (not the Spotify song currently playing). Not super important
  • Power Button on the HA Mediaplayer of the group does not work, it does nothing. No exceptions in the log is visible.
  • If you pick a song in the HA Mediaplayer for the Group, you get an error ("Failed to call service media_player/play_media. None") and in the Logs you get the following error:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:241
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 19:11:53 (2 occurrences)
Last logged: 19:20:58

[140088570596512] Unexpected exception
[140088441694544] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/teufel_raumfeld/media_player.py", line 553, in async_play_media
    await self._raumfeld.async_set_av_transport_uri(
  File "/usr/local/lib/python3.12/site-packages/hassfeld/__init__.py", line 767, in async_set_av_transport_uri
    zone_loc = self.resolve["udn_to_devloc"][zone_udn]
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: None

This is exactly the same error as #56, so I assume the person issuing this bug had his player as well in Spotify mode. The same error can be triggered if picking the "Media" Menu Item from the Sidebar of HA and then picking the Raumfeld Group als Player and Navigating to a file and trying to play it.

All three issues go away if you use the Raumfeld Mobile App to first play a local song from your storage. Then the Mediaplayer and everything starts to work again.

I assume the Raumfeld devices are somehow in a different state if Spotify is or was currently planning. This might explain some other bug reports.