[Solved] Automation: Play Spotify on Google Nest Audio Speaker

Hi guys,
I just recently find myself enjoying HA, digging into more complex automations with YAML. However, I can’t get this to work properly:

Automation Idea
If I am playing spotify on my smartphone and one of my mmWave Presence-Sensors recognizes I am in a room, it should switch the spotify music to be played on my Google Nest Audio smart speakers instead.

This works easily, as both my speaker and my smartphone is connected to the same spotify account. When I command my smart speaker to play spotify, playback on my phone stops and resumes on said speaker.

The Issue
My code works when I previously selected the nest audio speaker to play music (e.g. from my pc) and paused the music before triggering. But as soon as the speaker automatically reaches its “off” state after a few minutes, I get an error.
I tried preventing the speaker from going into “off” state, and was successful, but this also does not resolve this issue. I conclude that it has to be something about the connection between Spotify and the smart speaker, that gets cutted, so I can’t get the command through because it simply cannot “reconnect” to Spotify once it went “off”.

I find this to be quite strange because the speaker itself can play Spotify as a standalone device without some previous connection to another playback device on voice command.

My YAML:

action:
  - service: media_player.turn_on
    target:
      entity_id: media_player.bedroom_pair_2
    data: {}
  - delay: "00:00:05"
  - service: media_player.select_source
    target:
      entity_id: media_player.spotify_<username>
    data:
      source: Bedroom Pair
    enabled: true
  - service: media_player.play_media
    target:
      entity_id: media_player.spotify_<username>
    data:
      media_content_type: spotify://track
      media_content_id: spotify:track:4N7OgM0tMh7AQ12hRDq26e
    enabled: true
mode: restart

Exec errors when not previously connected to another playback device:

Entity media_player.spotify_<username> does not support this service.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:307
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:49:00 (12 occurrences)
Last logged: 19:19:58

[546921994048] Error handling message: must contain at least one of entity_id, device_id, area_id, floor_id, label_id.. Got {'type': 'execute_script', 'sequence': [{'service': 'media_player.select_source', 'data': {'source': 'bedroom_pair_2'}}], 'id': 72} (invalid_format) firstname lastname from XX.XX.XX.XX (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36)
[546921994048] Error handling message: must contain at least one of entity_id, device_id, area_id, floor_id, label_id.. Got {'type': 'execute_script', 'sequence': [{'service': 'media_player.select_source', 'data': {'source': 'Bedroom Pair'}}], 'id': 74} (invalid_format) firstname lastname from XX.XX.XX.XX (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36)
[546998864576] Error handling message: Entity media_player.spotify_<username> does not support this service. (home_assistant_error) firstname lastname from XX.XX.XX.XX (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36)
[546982127936] Error handling message: extra keys not allowed @ data['enabled']. Got None (invalid_format) firstname lastname from XX.XX.XX.XX (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36)
[546989478464] Error handling message: Entity media_player.spotify_<username> does not support this service. (home_assistant_error) firstname lastname from XX.XX.XX.XX (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36)
Source: helpers/script.py:1934
First occurred: 18:03:58 (11 occurrences)
Last logged: 19:19:58

websocket_api script: Error executing script. Invalid data for call_service at pos 1: must contain at least one of entity_id, device_id, area_id, floor_id, label_id.
websocket_api script: Error executing script. Error for call_service at pos 1: Entity media_player.spotify_<username> does not support this service.
websocket_api script: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['enabled']

Any support is greatly appreciated!

Edit: I made it work! Just had to install spotcast and follow the README.