Created
April 28, 2023 22:07
-
-
Save zackfern/c9aab7c65e0cbb16684155fc866da821 to your computer and use it in GitHub Desktop.
A Home Assistant script to make a Sonos speaker join whichever speaker is currently playing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to your scripts.yaml file | |
join_playing_sonos: | |
description: "Make a Sonos spaker join whichever speaker is current playing." | |
fields: | |
target: | |
description: "Entity ID of the Sonos which you'd like to make join the group" | |
example: "media_player.office" | |
variables: | |
group_owner: '{{ state_attr((integration_entities("sonos") | select("is_state", "playing") | first), "group_members") | first }}' | |
sequence: | |
- alias: "Join Sonos to currently playing group" | |
service: media_player.join | |
data: | |
group_members: | |
- "{{ target }}" | |
target: | |
entity_id: "{{ group_owner }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment