Hello. On development group, i can put on the domain, media_player / on service media_play_pause and on service data, {“entity_id”:“media_player.master_bedroom_home”} and work. i am trying to learn scripts… Can some one give me an example on how wil be the same but on an scripts on the configuration.yaml please?
Scripts look like this:
test:
alias: This is a test script
sequence:
- service: light.turn_on
entity_id: light.whatever_its_called
- service: media_player.play_media
data:
entity_id: media_player.squeezeplay
media_content_type: PLAYLIST
media_content_id: spotify:user:ih8gates:playlist:3C4vzY7mOqylGLmGRlPplf
Thanks ih8gates i did this an did not work i must have some error…
on configuration.yaml i call the scripts like this script: !include scripts.yaml
and on scripts.yaml i have
test:
alias: This is a test script
sequence:
- service: media_play_pause
entity_id: media_player.master_bedroom_home
- service: volume_down
entity_id: media_player.master_bedroom_home
i also did try
-test:
alias: This is a test script
sequence:
- service: media_play_pause
entity_id: media_player.master_bedroom_home
- service: volume_down
entity_id: media_player.master_bedroom_home
and the rror is
16-12-08 02:32:38 homeassistant.bootstrap: Invalid config for [script]: expected a dictionary for dictionary value @ data[‘script’][‘alias’]. Got ‘This is a test script’
expected a dictionary for dictionary value @ data[‘script’][‘sequence’]. Got [OrderedDict([(‘service’, ‘media_play_pause’), (‘entity_id’, ‘media_player.master_bedroom_home’)]), OrderedDict([(‘service’, ‘volume_down’), (‘entity_id’, ‘media_player.master_bedroom_home’)])]
You are missing the domain part in both of the services.
The domain in this case is media_player. So…
- service: media_player.media_play_pause
- service: media_player.volume_down
If you have this in a separate scripts.yaml, you’ll want to make sure that “test:” is at the left margin. You don’t use the “-” (minus sign) notation with scripts.
Be sure you’re using spaces to indent, not tabs. If you’re on windows, here’s some editing tips: