Hello, I’m trying to do my first automation: if it’s not yet the sun, I want that with the gate opening HA will switch on a light.
I wrote this:
automation:
- name: Automatic gate lights
trigger:
service: switch.turn_on
entity_id: switch.gate
condition:
platform: numeric_state
entity_id: sun.sun
value_template: “{{ state.attributes.elevation }}”
below: -4.0
action:
- service: light.turn_on
entity_id: light.gate- delay: 00:05:00
- service: light.turn_off
entity_id: light.gate
After a lot of error I arrived to this, but always with errors (ERROR:homeassistant.config:Invalid config for [automation]: [platform] is an invalid option for [automation]. Check: automation->condition->0->platform. (See /home/homeassistant/.homeassistant/configuration.yaml, line 306).) - alias: Notte esterno
trigger: - platform: state entity_id: switch.gate to: 'ON' condition: - platform: numeric_state entity_id: sun.sun value_template: "{{ state.attributes.elevation }}" below: -4.0 action: - entity_id: light.gate to: 'ON' - delay: 00:05:00 - entity_id: light.gate to: 'OFF'
I hope anyone could help me. Thank you very much!