Hi, I am trying to get the following automation running:
- id: 'weekendeveregaladjust'
alias: Weekend Eve Regal adjust
trigger:
- platform: time
minutes: '/10'
seconds: 00
condition:
- condition: state
entity_id: group.stube
state: 'on'
- condition: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 14
above: -70.0
- condition: time
after: '15:15:00'
before: '22:45:00'
weekday:
- wed
- fri
- sat
- sun
- condition: template
value_template: '{{ as_timestamp(now()) - as_timestamp(states.automation.weekend_eve_regal_adjust.attributes.last_triggered) | int > 898 }}'
action:
service: light.turn_on
data:
entity_id: light.led_regal
transition: 900
brightness_pct: 100
data_template:
xy_color: >
{% if state_attr('sun.sun', 'elevation') | float | round(0) >= 16 and states('sensor.time') <= '18:30' %}
0.16,0.504
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= 12 and states('sensor.time') <= '19:00' %}
0.375,0.557
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= 8 and states('sensor.time') <= '19:30' %}
0.608,0.373
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= 0 and states('sensor.time') <= '20:00' %}
0.40530,0.39072
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -8 and states('sensor.time') <= '20:30' %}
0.42336,0.39895
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -24 and states('sensor.time') <= '21:00' %}
0.43693,0.40407
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -30 and states('sensor.time') <= '21:30' %}
0.45186,0.40863
{% elif state_attr('sun.sun', 'elevation') | float | round(0) >= -36 and states('sensor.time') <= '22:00' %}
0.46823,0.41230
{% else %}
0.48614,0.41467
{% endif %}
Unfortunately, it does not work. Using [] around the numbers also does not work. I think generally it is correct, because with Kelvin: and just one number it works, but xy_color needs a list and I am not sure how to do it.
Thanks for help.