Invalid config for automation

Setup Information:

Raspberry Pi 3
Home Assistant All In One Installer
Aeotec Z-Stick Gen5

Hi All,
I am attempting to setup my configuration files in a distributed approach from the beginning but I am encounter errors in home-assistant.log. The error I have received in the log file is:

2017-12-02 04:11:48 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [automation] is an invalid option for [automation]. Check: automation->automation. (See /home/homeassistant/.homeassistant/configuration.yaml, line 15). Please check the docs at https://home-assistant.io/components/automation/

I have checked the docs many times for how to reference files to correctly implement the distributed approach, but I’m at a loss for where my mistake is located.

Below is a portion of my configuration.yaml file as well as the automation.yaml file.

Configuration.yaml

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: XX.XXXXX
  longitude: XX.XXXX
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 351
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/New_York
  customize: !include customize.yaml

group: !include groups.yaml
automation: !include automation.yaml
script: !include scripts.yaml

Automation.yaml

automation:

  - alias: "Christmas ligh  ts turn on at sunset and turn off five hours later."
    trigger:
      platform: sun
      event: sunset
    action:
      service: switch.turn_on
      entity_id: sensor.aeotec_zw096_smart_switch_6_power

  - alias: "Turn off Christmas lights after five hours."
    trigger:
      platform: state
      entity_id: sensor.aeotec_zw096_smart_switch_6_power
      to: 'off'
      for:
        hours: 5
    action:
      service: switch.turn_off
      entity_id: sensor.aeotec_zw096_smart_switch_6_power

The only error I am finding through yaml linter in Atom is an unknown tag error on the line customize: !include.yaml
but there isn’t an error in the log file and the information included in the customize file is updated correctly in the frontend of the HA UI (e.g. changing a sensor to a friendly name).

Any suggestions on how I messed this up?

Thanks in advance!

I would check for extra spaces at the ends of your groups or automation include lines… also I don’t know if it matters but mine is automationS.yaml maybe the pluralization matters?

You can’t have automation: in automation.yaml as you have already defined it in the config.yaml

3 Likes

Thanks for the suggestions. I looked through the YAML and didn’t find and spaces. In addition, I put it through the YAMLlint.com website as well to ensure the syntax is accurate.

I don’t believe the file name is important, but that it is referenced correctly. I have tried playing around this both and that wasn’t the issue. In addition, I have seen it done both ways in some the github accounts that have made their config available.

Appreciate the time and effort though!

Not sure where I have any automation in the configuration.yaml file. What are you referring to @keithh666?

I believe he is referring to the first line in the code you posted “automation:” Your automations.yaml needs no such heading it just starts with first trigger action etc

In your automation.yaml file remove the first line that says “automation:”. That is not necessary since that reference is aleady included in the configuration.yaml file.

See here…

for why you don’t have automation:, script:, group: etc in both the config.yaml and the spilt files.

Thanks everyone for the feedback and support. I believe that fixed the error I have been receiving.

Not sure where I saw that I needed to start the automation file with

automation:

Its been a fun but interesting journey with HA!

Glad to hear you got it working :slight_smile:

So I was able to resolve the config error, but the automation doesn’t work :frowning:

I have two sets of automation scripts for the Christmas lights based on the feedback in this thread.

  1. christmasTurnOnLights.yaml - It is supposed to turn on the lights connected to a Aeotec by Aeon Labs ZW096 Smart Switch at sunset.
  2. christmasTurnOffLights.yaml - It is supposed to turn off the lights connected to the same Aeotec switch 5 hours after the switch was turned on.

I have all the automation scripts included in a folder called automation.

The configuration file references the folder with:

automation: !include_dir_merge_list automation

Below are the scripts that we written:

christmasTurnOnLights.yaml

###Christmas Automation - Turns on the Christmas lights at sunset.

- alias: "chrismasTurnOnLights"
  trigger:
    platform: sun
    event: sunset
  action:
    service: switch.turn_on
    entity_id: sensor.aeotec_zw096_smart_switch_6_power

.

###Christmas Automation - Turns off the Christmas lights 5 hours after coming on.

- alias: "chrismasTurnOffLights"
  trigger:
    platform: state
    entity_id: sensor.aeotec_zw096_smart_switch_6_power
    to: 'off'
    for:
      hours: 5
  action:
    service: switch.turn_off
    entity_id: sensor.aeotec_zw096_smart_switch_6_power

Can anyone spot what I am doing wrong? The scripts do show up on the frontend of HA.

Thanks in advance for the help!

1

Your trigger for the off automation is when it is “off” for 5 hours so unless you turn it off it will never start that 5 hour timer… you could make it sunset and off-set it +5 hours if that’s what you want vs just a specific time at night. You could also just change that off to on

1 Like
###Christmas Automation - Turns off the Christmas lights 5 hours after coming on.

- alias: "chrismasTurnOffLights"
  trigger:
    platform: state
    entity_id: sensor.aeotec_zw096_smart_switch_6_power
    to: 'on'
    for:
      hours: 5
  action:
    service: switch.turn_off
    entity_id: sensor.aeotec_zw096_smart_switch_6_power

As @Bartem said, your logic there was reversed. You need to be (as shown above) checking for the switch to be on for 5 hours, before you turn it off.

You can’t switch on a sensor, it should be …

service: switch.turn_off
entity_id: switch.aeotec_zw096_smart_switch_6

Same for turn on :smiley:

Look in the states table for the correct name I’m just guessing here :stuck_out_tongue: