sapnho
(Wolfgang)
November 21, 2018, 1:45pm
1
I tried many things but I just don’t understand why the script
'1542806218565':
alias: Wolfgangs Favorites
sequence:
- data:
entity_id: media_player.wohnzimmer
shuffle: 'true'
source: Wolfgangs all-time favorites
service: media_player.select_source
doesn’t do anything. When I take out the “Shuffle” it works but I want the playlist shuffled. I triggers a Sonos media player.
Obvious mistake?
According to the media_player docs, select_source and shuffle_set are two different services. Maybe:
'1542806218565':
alias: Wolfgangs Favorites
sequence:
- data:
entity_id: media_player.wohnzimmer
source: Wolfgangs all-time favorites
service: media_player.select_source
- data:
entity_id: media_player.wohnzimmer
shuffle: true
service: media_player.shuffle_set
1 Like
sapnho
(Wolfgang)
November 22, 2018, 7:22am
4
The only thing that isn’t perfect yet is that the playlist will always start with the same song. After that it shuffles. So, maybe I’ll put a “stop playing” after the first command, do the “shuffle” and then “start playing” again.
sapnho
(Wolfgang)
November 22, 2018, 7:57am
5
Hmm, that does the shuffle right but it doesn’t start playing.
'1542806218565':
alias: Wolfgangs Favorites
sequence:
- data:
entity_id: media_player.wohnzimmer
source: Wolfgangs all-time favorites
service: media_player.select_source
- data:
entity_id: media_player.wohnzimmer
service: media_player.media_stop
- data:
entity_id: media_player.wohnzimmer
shuffle: 'true'
service: media_player.shuffle_set
- data:
entity_id: media_player.wohnzimmer
service: media_player.play_media
Maybe too many commands in fast sequence?
sapnho
(Wolfgang)
November 22, 2018, 10:45am
6
Well, this is weird. When I add a delay command the script is changed into a switch in the lovelace frontend.
'1542806218565':
alias: Wolfgangs Favorites
sequence:
- data:
entity_id: media_player.wohnzimmer
source: Wolfgangs all-time favorites
service: media_player.select_source
- data:
entity_id: media_player.wohnzimmer
service: media_player.media_stop
- data:
entity_id: media_player.wohnzimmer
shuffle: 'true'
service: media_player.shuffle_set
- delay: 'seconds: 2'
- data:
entity_id: media_player.wohnzimmer
service: media_player.play_media
It’s not weird, it’s what is supposed to happen, so you can stop it running during the delay if you need to.
sapnho
(Wolfgang)
November 25, 2018, 10:05am
8
Ah, thanks @anon43302295 . Is there a way to change this behavior? It’s a delay of a few seconds, I don’t need the option to stop the execution of the script.
Sure, under your customize:
put
script.NAME_OF_SCRIPT:
can_cancel: false
1 Like
sapnho
(Wolfgang)
November 25, 2018, 12:21pm
10
You’re the master. Thanks!
1 Like