I am struggling with templating in an automation. In the automation, I have 2 triggers, when either of the triggers are invoked I want to then set a Hue “scene” accordingly:
alias: Auto Hue
description: Test Automation of Hue Lights
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: '+6'
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: '-6'
action:
- condition: numeric_state
entity_id: sun.sun
- service: script.set_front_porch_light
data:
huescene: >
{% if state.attributes.elevation == '+6' %}
Hue-Front-Porch-Dim-Scene
{% else %}
Hue-Front-Porch-Norm-Scene
{% endif %}
mode: single
I am getting a syntax error when attempting to save this: It is looking fore a “before” or “after”.
A push in the right direction, would be very much appreciated. ‘’’