SteffenDE
(Steffen)
October 12, 2019, 12:19pm
1
Hi,
I’m new to hass.io and now I start to automate my Sonos Media Players. First I want to create some scripts to use standard doings again from the script definition. So I create this:
script_sonosmedia_master_off:
alias: "Sonos Master OFF"
sequence:
- service: media_player.turn_off
entity_id:
- media_player.bad
- media_player.buro
- media_player.computer
- media_player.keller
- media_player.kuche
- media_player.schlafzimmer
- media_player.terrasse
- media_player.toilette
- media_player.wohnzimmer
But if I set tap action to call-service and this service script_sonosmedia_master_off nothing happens. Whats wrong here?
Thanks you, Steffen
Tediore
October 12, 2019, 12:39pm
2
The service needs to be script.turn_on
, and then you need to specify the entity ID of this script.
Whoops. I was wrong, see below.
tom_l
October 12, 2019, 12:40pm
3
No you dont. Scripts are services. This is vaild:
tap_action:
action: call-service
service: script.script_sonosmedia_master_off
SteffenDE
(Steffen)
October 12, 2019, 12:44pm
4
Hi,
could you explain a little bit more, I do not understood?
I want to create some basic scripts for my Sonos devices to use at the automations and fail at the first simple stop alle Sonos from playing. Is the script integration the right place to put the reusable sequences?
At my button I try this:
entity: sensor.tmp_sonosmedia_master
hold_action:
action: none
show_icon: true
show_name: true
tap_action:
action: call-service
service: script.script_sonosmedia_master_off
type: entity-button
But I think it is a problem with the script because if I try the service at dev area nothing happens too!
Thank you.
Tediore
October 12, 2019, 12:47pm
5
TIL. Thanks for clarifying.
tom_l
October 12, 2019, 12:53pm
6
I mean you can do it your way, it’s just not the only way. Sorry if I came across as a bit rude. Was not my intention.
@SteffenDE
If the script is not doing what you expect when you run it from the dev tools services menu, check the log for errors.
SteffenDE
(Steffen)
October 12, 2019, 12:58pm
7
At the logs I can not found something but I got it:
media_player.media_pause
not
media_player.turn_off
Sonos only stop the media but have no turn off function.
Steffen
1 Like