Hi
new to working with YAML and home assistant
was trying to create a simple script that would join 3 Sosnos speakers together, play a station, and also set the room temperature.
when I try to save the script, I get “extra keys not allowed @ data[‘sequence’][0][‘group_members’]” Also, it looks exactly like the documentation says it should work.
Appreciate any help
This is the script
alias: Gym Setup
sequence:
- service: media_player.join
group_members:
- media_player.dining_room
- media_player.living_room
entity_id:
- media_player.kitchen
- service: media_player.play_media
target:
entity_id: media_player.kitchen
data:
media_content_id: FV:2/2
media_content_type: favorite_item_id
metadata:
title: Galgalatz 91.8 FM
thumbnail: https://static.radio.de/images/broadcasts/e4/07/10506/2/c175.png
media_class: genre
children_media_class: null
navigateIds:
- {}
- media_content_type: favorites
media_content_id: ""
- media_content_type: favorites_folder
media_content_id: object.item.audioItem.audioBroadcast
- service: climate.set_temperature
metadata: {}
data:
temperature: 7
target:
entity_id:
- climate.kitchen
- climate.living_room
- climate.dining_room
mode: restart
icon: mdi:radio-tower
Troon
(Troon)
January 23, 2024, 10:16am
2
Are you missing a data:
?
- service: media_player.join
data:
group_members:
- media_player.dining_room
- media_player.living_room
entity_id:
- media_player.kitchen
Hi
that doesnt make any difference still getting the error
Troon
(Troon)
January 23, 2024, 11:39am
4
Looking at the structure of that service call in Developer Tools / Services, it looks like it’s expecting:
- service: media_player.join
target:
entity_id: media_player.kitchen
data:
group_members:
- media_player.dining_room
- media_player.living_room
The docs also warn “Only works on supported multiroom audio systems”. Can you successfully run the join command from the Developer Tools / Services screen?
YAML mode:
UI mode:
(inconsistent rendering of entities because I have a Bedroom and Dining Room media player in my system, but not a Living Room)
it works on the developer tools as a stand alone but as soon as I coy and paste to the script under sequence I get the error
Troon
(Troon)
January 23, 2024, 1:06pm
6
Indentation is horribly wrong on that screenshot. In YAML, indentation is critical.
Troon:
Indentation
fixed indentation but still have the error
script:
alias: Gym Setup
sequence:
- service: media_player.join
data:
group_members:
- media_player.living_room
- media_player.dining_room
target:
entity_id: media_player.kitchen
- service: media_player.play_media
target:
entity_id: media_player.kitchen
data:
media_content_id: FV:2/2
media_content_type: favorite_item_id
metadata:
title: Galgalatz 91.8 FM
thumbnail: https://static.radio.de/images/broadcasts/e4/07/10506/2/c175.png
media_class: genre
children_media_class: null
navigateIds:
- {}
- media_content_type: favorites
- media_content_id: ""
- media_content_type: favorites_folder
- media_content_id: object.item.audioItem.audioBroadcast
- service: climate.set_temperature
metadata: {}
data:
temperature: 7
target:
entity_id:
- climate.kitchen
- climate.living_room
- climate.dining_room
mode: restart
icon: mdi:radio-tower
Troon
(Troon)
January 23, 2024, 1:32pm
8
Still a few oddities:
If you’re pasting into the Script Editor, you don’t need the script
at the start.
alias
and the sequence
s should be at the same level
entity_id
not indented in play_media
target
over-indented in set_temperature
This works when pasted into Settings / Scripts / Add Script (switch to YAML mode):
alias: Gym setup
sequence:
- service: media_player.join
data:
group_members:
- media_player.living_room
- media_player.dining_room
target:
entity_id: media_player.kitchen
- service: media_player.play_media
target:
entity_id: media_player.kitchen
data:
media_content_id: FV:2/2
media_content_type: favorite_item_id
metadata: null
title: Galgalatz 91.8 FM
thumbnail: https://static.radio.de/images/broadcasts/e4/07/10506/2/c175.png
media_class: genre
children_media_class: null
navigateIds:
- {}
- media_content_type: favorites
- media_content_id: ""
- media_content_type: favorites_folder
- media_content_id: object.item.audioItem.audioBroadcast
- service: climate.set_temperature
target:
entity_id:
- climate.kitchen
- climate.living_room
- climate.dining_room
data:
temperature: 7
Thank you got it to work
this is the working script
alias: Gym Setup
mode: restart
icon: mdi:radio-tower
sequence:
- service: media_player.join
data:
group_members:
- media_player.living_room
entity_id: media_player.kitchen
- service: media_player.play_media
target:
entity_id: media_player.kitchen
data:
media_content_id: FV:2/2
media_content_type: favorite_item_id
- service: climate.set_temperature
data:
temperature: 7
entity_id:
- climate.kitchen
- climate.living_room
- climate.dining_room
1 Like