Invalid config for [automation]: expected a dictionary

Hey,

I tried to adapt Frenck’s config a little (https://github.com/frenck/home-assistant-config) and ran into issues when validating my configuration.

To include the automation, I am using:
automation: !include_dir_list ../../automations

And my first automation:

alias: Activate kitchen light preset
trigger:
  platform: event
  event_type: click
  event_data:
    entity_id: binary_sensor.switch_158d0001d8db30
    click_type: double
action:
- service: light.turn_off
  entity_id: light.schreibtisch
- service: light.turn_on
  entity_id:
    - light.kochen
    - light.kuechentisch_2
  data:
    brightness: 200

But somehow I am running into this error:

Invalid config for [automation]: expected a dictionary. Got OrderedDict([('config', OrderedDict()), ('sun', OrderedDict([('elevation', 17)])), ('automation', [OrderedDict([('alias', 'Activate preset desk light'), ('trigger', OrderedDict([('platform', 'event'), ('event_type', 'click'), ('event_data', OrderedDict([('entity_id', 'binary_sensor.switch_158d0001870ac2'), ('click_type', 'double')]))])), ('action', [OrderedDict([('service', 'light.turn_off'), ('entity_id', ['light.kochen', 'light.kuechentisch_2'])]), OrderedDict([('service', 'light.turn_on'),.... (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/

My folder structure is the same as Frenck’s with the only exception that his my root starts in his config/ directory.

The error does not help me at all and maybe someone can point me toward the solution.
Thanks in advance!

push - still haven’t made progress :frowning:

Not sure where …/…/automations is in your situation, but that directory should contain one or more yaml files, each with a single automation. So, e.g., that directory should contain a file whose name ends with .yaml, and contains the yaml code you show above, and only that. Other automations should each be in there own separate files. Is that what you have?

The error message seems to imply it’s found a .yaml file that contains other stuff.

1 Like

That is what I don’t understand.
The path is valid and contains only automation files, which I have been using before.

The error mentions the sun component, which is nowhere used within the automations directory.

Maybe trying changing to a full pathname instead of a relative pathname. Do you only have one directory named automations? If so, then it must be finding it. Very strange.

I found the issue.
With my old config, I used to sometimes have 2 automations in one file (mostly for on and off switches) but this does no longer work. Having only one automation per file fixed my issue.

Anyways, solved now and thanks for your help nonetheless!

Does that mean you have an Automations folder with individual automations as yaml files? If so do you have an automation.yaml file with includes for each automation?