I’m running into a persistent error message and no matter what I seem to change home assistant keeps giving it.
This is the error I’m receiving:
- Invalid config for [automation]: invalid template (TemplateSyntaxError: tag name expected) for dictionary value @ data[‘action’][0][‘service_template’]. Got None. (See /config/configuration.yaml, line 13). Invalid config for [automation]: required key not provided @ data[‘trigger’][0][‘event’]. Got None. (See /config/configuration.yaml, line 13). Invalid config for [automation]: required key not provided @ data[‘trigger’][0][‘event’]. Got None. (See /config/configuration.yaml, line 13). Invalid config for [automation]: required key not provided @ data[‘trigger’][0][‘event’]. Got None. (See /config/configuration.yaml, line 13). Invalid config for [automation]: required key not provided @ data[‘trigger’][0][‘event’]. Got None. (See /config/configuration.yaml, line 13).
And this is my configuration.yaml looks like:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
sensor:
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'date_time_utc'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
- 'beat'
- platform: dht
sensor: DHT22
pin: 4
monitored_conditions:
- temperature
- humidity
switch:
- platform: rpi_gpio
ports:
6: fan
19: fogger
26: light
Please show us your automations.yaml.
Sure, my automations.yaml looks like this:
### Lighting Control ###
- alias: Turn LED on Between 06:00 and 22:00
trigger:
- platform: homeassistant
event: start
- platform: template
value_template: "{{ states('sensor.time') == '06:00' }}"
- platform: template
value_template: "{{ states('sensor.time') == '22:00' }}"
action:
- service_template: >
{% '06:00' <= states('sensor.time') < '22:00' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.light
### Temperature/Humidity Control ###
# Temperature
- alias: Temperature-Fan On
trigger:
- platform: homeassistant
event: start
condition:
condition: numeric_state
entity_id: sensor.temperature
above: 35
action:
service: switch.turn_on
entity_id: switch.fan
- alias: Temperature-Fan Off
trigger:
- platform: homeassistant
event: start
condition:
condition: numeric_state
entity_id: sensor.temperature
below: 25
action:
service: switch.turn_off
entity_id: switch.fan
# Humidity
- alias: Humidity-Fan On
trigger:
- platform: home assistant
event: start
condition:
condition: numeric_state
entity_id: sensor.humidity
above: 80
action:
service: switch.turn_on
entity_id: switch.fan
- alias: Humidity-Fan Off
trigger:
- platform: homeassistant
event: start
condition:
condition: numeric_state
entity_id: sensor.humidity
below: 60
action:
service: switch.turn_off
entity_id: switch.fan
### Fogger Control ###
# Fogger
- alias: Fogger turns on for 14 minutes every 1 hour
trigger:
- platform: time_pattern
hours: '/1'
minutes: '00'
seconds: '00'
action:
- service: switch.turn_on
entity_id: switch.fogger
- delay: 00:14:00
- service: switch.turn_off
entity_id: switch.fogger
I’ve added event: start
under each - platform: homeassistant
but am still receiving the same error. I’ll update the automation.yaml to include that change though.
There’s another issue with your service_template in the first automation.
Should be:
{% if '06:00' <= states('sensor.time') < '22:00' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
No clue if that time comparsion works.
Not sure what ended up fixing the error, ended up changing some things from my own research as well as changes to an automation that wasn’t working, but I’m no longer receiving the error.
Thanks for your help! This error was really getting on my nerves.