My first script - can't get it to work

Hey guys,

i’ve been following this community for quite some time, was looking forward to start using HA when i would get my newly build home. Now finally the time has come that my house is done and im starting to use HA.

Installation was quick and good, no problems there, managed to get some wemo light working, device tracking setup.

But now i tried to do my first script to check if i could to messaging and switching lights when i get home.
I’ve checked the docs, examples, the internet but i can’t seem to figure out why my scripts aren’t working.
Could u guys help me out.

Here is my setup;

  • included a folder called scripts in my config.yaml
  • made a yaml file for my first script called woonkamerLampen.yaml
  • made a script following the docs

pieces of code:
configuration.yaml:

automation: !include automation.yaml
group: !include groups.yaml
zone: !include zones.yaml
script: !include_dir_merge_named scripts

woonkamerLampen.yaml:

sequence:

  • service: switch.turn_on
    entity_id: switch.woonkamer_01
  • service: notify.push
    data:
    message: ‘Ik ben thuis, lampen aan!’

error message:

2017-05-21 10:29:27 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: expected a dictionary for dictionary value @ data[‘script’][‘sequence’]. Got [OrderedDict([(‘service’, ‘switch.turn_on’), (‘entity_id’, ‘switch.woonkamer_01’)]), OrderedDict([(‘service’, ‘notify.push’), (‘data’, OrderedDict([(‘message’, ‘Ik ben thuis, lampen aan!’)]))])]. (See /home/homeassistant/.homeassistant/configuration.yaml, line 86). Please check the docs at Scripts - Home Assistant

Thanks a lot!

Hi @makkiej, Welcome to HA.
The script name is missing in your script.yaml.

example_script:
  sequence:
    # This is written using the Script Syntax
    - service: light.turn_on
      ...

I’ve read that if u only have one script in a script file that has a certain name, then u don’t need that line.
But i have had it added to the file before, and i still got an error message.

I’ve just tried your comment, and it did work, thanks a lot!
I guess i have made changes somewhere else in the past and left this piece as is… it was driving me nuts!

have a great sunday!