Error loading /config/configuration.yaml: mapping values are not allowed here in

Hello,

First off, I am very new to this so please forgive anything stupid I may ask…

I am getting this error:

Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/automations.yaml”, line 22, column 9

I just can’t seem to work out what it means. I’m pretty sure it relates to ‘action’ because but if I copy the action part of the code into dev/services it works as expected.

- id: fgd01
  alias: bgd
  description: Back gate doods
  trigger:
  - entity_id: image_processing.doods_back_gate
    platform: state
  condition:
  - condition: or
    conditions:
    - condition: template
      value_template: '{{ ''car'' in state_attr(''image_processing.doods_back_gate'',
        ''summary'') }}'
    - condition: template
      value_template: '{{ ''truck'' in state_attr(''image_processing.doods_back_gate'',
        ''summary'') }}'
    - condition: template
      value_template: '{{ ''person'' in state_attr(''image_processing.doods_back_gate'',
        ''summary'') }}'

  action:
   service: notify.mobile_app_mat
   data:
     title: CCTV notifacation
     message: Someone is at the back gate
     data:
       image: 'http://192.168.1.200:8123/local/doods_cam.jpg'
       actions:
         - action: URI
           title: View Live Feed
           uri: /lovelace/cct

mode: single

Thanks in advance.

Watch your indentation. It’s important. The worst offender in this case was mode: but there were others.

- id: fgd01
  alias: bgd
  description: Back gate doods
  trigger:
  - entity_id: image_processing.doods_back_gate
    platform: state
  condition:
  - condition: or
    conditions:
    - condition: template
      value_template: '{{ ''car'' in state_attr(''image_processing.doods_back_gate'', ''summary'') }}'
    - condition: template
      value_template: '{{ ''truck'' in state_attr(''image_processing.doods_back_gate'', ''summary'') }}'
    - condition: template
      value_template: '{{ ''person'' in state_attr(''image_processing.doods_back_gate'', ''summary'') }}'
  action:
    service: notify.mobile_app_mat
    data:
      title: CCTV notification
      message: Someone is at the back gate
      data:
        image: 'http://192.168.1.200:8123/local/doods_cam.jpg'
        actions:
        - action: URI
          title: View Live Feed
          uri: /lovelace/cctv
  mode: single

It was the indentation on mode:

wow, that’s sensitive isn’t it. Is there a compiler that’s good for this sort of thing?

Use Visual Studio Code with the Home Assistant Config Helper extension.

Other extensions that help:

Better Jinja
Indent-Rainbow
Rainbow-Brackets

1 Like

Thanks

I spoke too soon. I corrected the spacing to match your example which resolved the main issue and took me out of safe mode, but now I’m getting the follwing.

ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [mode] is an invalid option for [automation]. Check: automation->action->0->mode. (See /config/configuration.yaml, line 9)

.EDIT: i removed the mode line and its fine,. The GUI added it anyway.

You don’t have the same indentation as me.

mode: should be at the same indentation as action:

You seem to have mode: indented under action: according to that error.

I installed the visual studio element as you suggested and it has made things so much easier. Thank you for your help

1 Like