I would think this automation should work, but it doesn’t.
My intention is to group the Sonos BEAM, which is connected to Apple TV and playing TV sound, but when Apple TV is in the state idle Beam should rejoin (Sonos_join) the group in which media_player.kjokken is the master.
Somehow this does not work…
Any suggestions on how to accomplish this or is there an error in my code that I don’t see?
- alias: '[SONOS] - Sonos BEAM to group'
description: Add Sonos BEAM to group when Apple TV is in state IDLE
trigger:
platform: template
value_template: "{{ is_state('media_player.apple_tv_stua_1_etg, 'idle') }}"
action:
service: media_player.sonos_join
data:
master: media_player.kjokken
entity_id:
- media_player.sonos_beam_stue_1etg
- media_player.sonos_soverom
- media_player.sonos_bad
- media_player.sonos_kontoret
- media_player.sonos_lekerom
It seems I had to change to the Sonos service as per Home Assistant release 0.93
*before* service: media_player.sonos_join
*after* service: sonos.join
Now it interferes with the Sonos grouping, but still not as I want; adding media_player.sonos_beam_stue_1etg to the existing group, mastered by media_player.kjokken
I ended up with this working automation, which sets the Sonos speakers occupied by Apple TV when TV is playing, back into the group with the speakers in the kitchen and others.
- alias: '[SONOS] - BEAM to group'
description: Add Sonos BEAM to group when Apple TV is in state IDLE
trigger:
platform: template
value_template: "{{ is_state('media_player.apple_tv_stua_1_etg', 'idle') }}"
action:
- service: sonos.join
data:
master: media_player.sonos_kjokken
entity_id:
- media_player.sonos_stue_1_etg
- media_player.sonos_soverom
- media_player.sonos_bad
- media_player.sonos_kontoret
- media_player.sonos_lekerom