Hello,
I am new to HA and have been using the guides and forums to build my automation. Unfortunately, I am now stuck trying to get the following automation to work. It is supposed to change the color temperature of my LIFX lights based on the sun angle or time. Any ideas why it will not trigger at all?
- id: 'workweekeveninglightskelvinadjust'
alias: Workweek Eve Lights Kelvin adjust
trigger:
- platform: time
minutes: '/5'
seconds: 00
condition:
- condition: state
entity_id: group.stube
state: 'on'
- condition: numeric_state
entity_id: sun.sun
below: 9.5
above: -30.0
- condition: time
after: '15:15:00'
before: '22:15:00'
weekday:
- mon
- tue
- wed
- thu
- fri
action:
service: light.lifx_set_state
data:
entity_id: group.stube
transition: 900
data_template:
kelvin: >
{% if state_attr('sun.sun', 'elevation') | float | round(0) >= 9 and states('sensor.time') <= '18:30' %}
5000
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= 6 and states('sensor.time') <= '19:00' %}
4500
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= 3 and states('sensor.time') <= '19:30' %}
4000
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= 0 and states('sensor.time') <= '20:00' %}
3500
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -3 and states('sensor.time') <= '20:30' %}
3200
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -6 and states('sensor.time') <= '21:00' %}
3000
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -9 and states('sensor.time') <= '21:30' %}
2750
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -12 and states('sensor.time') <= '22:00' %}
2500
{% else %}
2500
{% endif %}
Any ideas? Thanks for help.
Cheers