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

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

Hi guys,
I only in the near past discover myself having fun with HA, digging into extra complicated automations with YAML. However, I can’t get this to work correctly:

Automation Idea
If I’m enjoying spotify on my smartphone and considered one of my mmWave Presence-Sensors acknowledges I’m in a room, it ought to change the spotify music to be performed on my Google Nest Audio good audio system as an alternative.

This works simply, as each my speaker and my smartphone is linked to the identical spotify account. When I command my good speaker to play spotify, playback on my telephone stops and resumes on mentioned speaker.

The Issue
My code works after I beforehand chosen the nest audio speaker to play music (e.g. from my laptop) and paused the music earlier than triggering. But as quickly because the speaker robotically reaches its “off” state after a couple of minutes, I get an error.
I attempted stopping the speaker from going into “off” state, and was profitable, however this additionally doesn’t resolve this situation. I conclude that it needs to be one thing concerning the connection between Spotify and the good speaker, that will get cutted, so I can’t get the command by way of as a result of it merely can not “reconnect” to Spotify as soon as it went “off”.

I discover this to be fairly unusual as a result of the speaker itself can play Spotify as a standalone system with out some earlier connection to a different playback system on voice command.

My YAML:

motion:
  - service: media_player.turn_on
    goal:
      entity_id: media_player.bedroom_pair_2
    information: {}
  - delay: "00:00:05"
  - service: media_player.select_source
    goal:
      entity_id: media_player.spotify_<username>
    information:
      supply: Bedroom Pair
    enabled: true
  - service: media_player.play_media
    goal:
      entity_id: media_player.spotify_<username>
    information:
      media_content_type: spotify://observe
      media_content_id: spotify:observe:4N7OgM0tMh7AQ12hRDq26e
    enabled: true
mode: restart

Exec errors when not beforehand linked to a different playback system:

“Entity media_player.spotify_<username> doesn't assist this service.”

"

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

[546921994048] Error dealing with message: should include at the very least considered one of entity_id, device_id, area_id, floor_id, label_id.. Got {'sort': '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 dealing with message: should include at the very least considered one of entity_id, device_id, area_id, floor_id, label_id.. Got {'sort': '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 dealing with message: Entity media_player.spotify_<username> doesn't assist 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 dealing with message: additional keys not allowed @ information['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 dealing with message: Entity media_player.spotify_<username> doesn't assist 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)

"

Any assist is enormously appreciated!

1 put up – 1 participant

Read full subject

HI-FI News

by way of Home Assistant Community – Latest subjects https://ift.tt/UkbBO8I

May 2, 2024 at 07:26PM