First automation try with HA. I am just trying to turn on my porch lights based on sun and turn them off based on sun with an offset on both. I am doing a separate automations.yaml right away as I want to keep this clean from the beginning without having to redo it later as things get more complicated. I have the following in the automations.yaml:
#Porch Lights
- alias: Turn on porch lights when sun sets
trigger:
platform: sun
event: sunset
offset: "+00:15:00"
action:
service: switch.turn_on
entity_id: switch.ge_14292_inwall_smart_toggle_switch_switch
- alias: Turn off porch lights when sun rises
trigger:
platform: sun
event: sunrise
offset: "-00:15:00"
action:
service: switch.turn_off
entity_id: switch.ge_14292_inwall_smart_toggle_switch_switch
When I run a check on the configuration I get the following error:
Configuration invalid
extra keys not allowed @ data[āautomationā]
If I comment out the automation: !include automations.yaml
The error goes away but obviously the automation doesnāt work.
Itās probably a spacing issue. I would look up an example of automations.yaml in someoneās Github. And check spaces. Sorry donāt have access to my own examples right now.
homeassistant:
# Name of the location where Home Assistant is running
name: Name
# Location required to calculate the time the sun rises and sets
latitude: 43
longitude: -88
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 500
# 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/Chicago
# Customization file
customize: !include customize.yaml
# Automation File
automation: !include automations.yaml
# Show links to resources in log and frontend
introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
history:
# View all events in a logbook
logbook:
# Enables a map showing the location of tracked devices
map:
# Track the sun
sun:
# Weather prediction
sensor:
- platform: yweather
name: weather_current
woeid: 12780788
monitored_conditions:
- weather
- weather_current
- temp_min
- temp_max
- wind_speed
- pressure
- visibility
- humidity
- temperature
group:
weather_current:
name: Weather Current
view: no
entities:
- sensor.weather_current_condition
- sensor.weather_current_current
- sensor.weather_current_humidity
- sensor.weather_current_pressure
- sensor.weather_current_temperature
- sensor.weather_current_temperature_max
- sensor.weather_current_temperature_min
- sensor.weather_current_visibility
- sensor.weather_current_wind_speed
- sun.sun
#automation:
# - alias: Turn on porch lights when sun sets
# trigger:
# platform: sun
# event: sunset
# offset: "+00:15:00"
# action:
# service: switch.turn_on
# entity_id: switch.ge_14292_inwall_smart_toggle_switch_switch
# - alias: Turn off porch lights when sun rises
# trigger:
# platform: sun
# event: sunrise
# offset: "-00:15:00"
# action:
# service: switch.turn_off
# entity_id: switch.ge_14292_inwall_smart_toggle_switch_switch
# Text to speech
tts:
- platform: google
# Z-Wave
zwave:
usb_path: /dev/ttyACM0
# Configurator
panel_iframe:
configurator:
title: Configurator
icon: mdi:wrench
url: http://hassio.local:3218
# Cloud
#cloud:
#group: !include groups.yaml
#automation: !include automations.yaml
script: !include scripts.yaml
not give me problems being indented two spaces? Is that file link treated differently than automation.yaml? I didnāt glean that info from the configuration documents if that is the case.
I remember my C++ classes 20 years ago and it was always syntax, syntax, syntax! This is giving me flashbacks.
I was reading someone elseās post about this and there seemed to be some confusion over whether the sun is being used as a trigger or a condition. I took it to mean you are correct if I am using sun as a condition but what I did is supposed to be correct as a trigger. I could be very wrong on that but Iāll know more tonight when the automation works or not.