Expected dict for dictionary value @ data

Dear @ll,

i’m getting this error message, but i’m being unable to find out what’s the reason.

Logger: homeassistant.config
Source: config.py:443
First occurred: 3:45:30 PM (1 occurrences)
Last logged: 3:45:30 PM

Invalid config for [automation]: expected dict for dictionary value @ data['action'][0]['data']. Got None extra keys not allowed @ data['action'][0]['message']. Got None. (See /var/homeassistant/.homeassistant/configuration.yaml, line 17).

configuration.yaml file containes (first lines)

# Configure a default setup of Home Assistant (frontend, api, etc)




default_config:

recorder:
  purge_keep_days: 10

# Text to speech
tts:
  - platform: google_translate

#group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
  server_port: 8123
  use_x_forwarded_for: true
  trusted_proxies:
   - 127.0.0.1
   - 192.168.80.4
#  ip_ban_enabled: true
#  login_attempts_threshold: 5
#  ssl_certificate: /var/homeassistant/.homeassistant/server.pem
#  ssl_key: /var/homeassistant/.homeassistant/server.key
#
#
#lovelace:
#  mode: yaml# Configure a default setup of Home Assistant (frontend, api, etc)

#homeassistant:
#       name: PjWHeim
#        external_url: "https://wolke.wollny.com.br:8123"
#        internal_url: "http://wolke.wollny.com.br:8123"

default_config:

recorder:
  purge_keep_days: 10

# Text to speech
tts:
  - platform: google_translate

#group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
  server_port: 8123
  use_x_forwarded_for: true
  trusted_proxies:
   - 127.0.0.1
   - 192.168.80.4
#  ip_ban_enabled: true
#  login_attempts_threshold: 5
#  ssl_certificate: /var/homeassistant/.homeassistant/server.pem
#  ssl_key: /var/homeassistant/.homeassistant/server.key
#
#
#lovelace:
#  mode: yaml

#map:

geo_location:
  - platform: geo_json_events
    url: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson

logger:
  default: info
  logs:
    mysensors: debug
    homeassistant.components.mysensors: debug


#map:

geo_location:
  - platform: geo_json_events
    url: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson

logger:
  default: info
  logs:
    mysensors: debug
    homeassistant.components.mysensors: debug

any hint?

thx in advance.

Hint, post the code from automations.yaml. :wink: :slight_smile:

automations.yaml

- alias: Zone Notifications
  trigger:
  - platform: zone
    entity_id:
      - device_tracker.pwmi6
    zone: zone.PjWHeim
    event: enter
  - platform: zone
    entity_id:
      - device_tracker.pwmi6
    zone: zone.PjWHeim
    event: leave
  - platform: zone
    entity_id:
      - device_tracker.pwmi6
    zone: zone.luciana
    event: enter
  - platform: zone
    entity_id:
      - device_tracker.pwmi6
    zone: zone.luciana
    event: leave
  action:
  - service: notify.mobile_app_pwmi6
    data:
    message: >
        {% if trigger.event == "leave" %}
          {{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
        {% else %}
          {{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
        {% endif %}


You need to indent the message option by two spaces to the right. You currently have it aligned with data but it should be like this:

  - service: notify.mobile_app_pwmi6
    data:
      message: >
        {% if trigger.event == "leave" %}
          {{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
        {% else %}
          {{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
        {% endif %}

If you’re interested, you can also reduce the template to this:

  - service: notify.mobile_app_pwmi6
    data:
      message: >
        {{ trigger.from_state.name }} {{ 'left' if trigger.event == 'leave' else 'entered' }} {{ trigger.zone.attributes.friendly_name }}

thank you. i really didn’t notice it.

can you please let me know where this indent instruction is written, as i didn’t see it?

There’s an example in the documentation for the Notification integration (what you are using).

action:
  service: notify.notify
  data:
    message: "The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!"

Generally speaking, all options listed under data are normally indented. Here’s another example from the Light integration:

  action:
    - service: light.turn_on
      target:
        entity_id: light.ledliststair
      data:
        brightness: 130
        rgb_color: [255,0,0]

For more information about Home Assistant’s use of YAML, refer to this section of the documentation.

If your question was answered to your satisfaction, please consider marking my post (above) with the Solution tag. Only you, the author of this topic, can select one post to represent the solution to your question. By doing so, it will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.