My very first automation fails, what is wrong with it?

Trying to create my very first automation, but it fails and fails and fails, what is wrong with it? :slight_smile:

Took automation from here: https://www.hackster.io/robin-cole/pi-camera-doorbell-with-notifications-408d3d

Automation is added to automation.yaml, there is nothing more than below.
automation: !include automations.yaml is on configuration.yaml

  - alias: Doorbell_pressed_automation 
   trigger: 
     platform: mqtt 
     topic: dev/test
     payload: 'Capture!' 
   action: 
     - service: automation.turn_off 
       entity_id: automation.doorbell_pressed_automation 
     - service: script.turn_on 
       entity_id: script.doorbell_pressed_script 
     - delay: "00:00:5" 
     - service: automation.turn_on 
       entity_id: automation.doorbell_pressed_automation 

Config check:

Configuration invalid
Testing configuration at /config
2018-01-31 22:18:43 ERROR (SyncWorker_0) [homeassistant.util.yaml] while parsing a block collection in “/config/automations.yaml”, line 1, column 3 expected , but found ‘’ in “/config/automations.yaml”, line 2, column 4
2018-01-31 22:18:43 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: while parsing a block collection in “/config/automations.yaml”, line 1, column 3 expected , but found ‘’ in “/config/automations.yaml”, line 2, column 4

From Hass info:

while parsing a block collection in “/config/automations.yaml”, line 1, column 2 expected , but found ‘’ in “/config/automations.yaml”, line 9, column 3
9:56 PM helpers/entity_component.py (ERROR)
while parsing a block collection in “/config/automations.yaml”, line 1, column 2 expected , but found ‘’ in “/config/automations.yaml”, line 9, column 3
9:56 PM util/yaml.py (ERROR)
while parsing a block collection in “/config/automations.yaml”, line 1, column 2 expected , but found ‘’ in “/config/automations.yaml”, line 9, column 3
9:55 PM helpers/entity_component.py (ERROR)
while parsing a block collection in “/config/automations.yaml”, line 1, column 2 expected , but found ‘’ in “/config/automations.yaml”, line 9, column 3
9:55 PM util/yaml.py (ERROR)

try like this:

  - alias: Doorbell_pressed_automation 
    trigger: 
      platform: mqtt 
      topic: dev/test
      payload: 'Capture!'
    action: 
      - service: homeassistant.turn_off 
        entity_id: automation.doorbell_pressed_automation 
      - service: script.doorbell_pressed_script
      - delay: "00:00:05" 
      - service: homeassistant.turn_on 
        entity_id: automation.doorbell_pressed_automation

besides the first line every other was missing a space, hopefully now it’s working.

You can also use automation.turn_on or script.turn_on, usually I just use homeassistant.turn_ because it can be used with every entity and for scripts I don’t use any I just put the script entity at the service and its been working flawless.

1 Like

indentation is exceptionally important in yaml.

if it is wrong then you will get errors and hass web interface won’t load.

Awesome, thank you! That was it :slight_smile:

Yes, I´ve really noticed that :smiley:
Found this one and it hopefully saves my lifes sometimes in the future :slight_smile: http://www.yamllint.com/

Also need to try some tweaks for Notepad++ as I didn´t saw my initial flaw with it.

Try Visual Studio Code.

1 Like