Sorry, I wasn’t clear. The above error is the OP’s. I’m trying to change the xy_color depending on the sensor.met_office_temperature. I’ve been following this thread, this one and this one, and trying to get it to work.
Here’s my current error
Invalid service data for light.turn_on: None for dictionary value @ data['xy_color']. Got '[0.4949,0.4202]'
and this is the automation
- id: test
alias: test
trigger:
platform: time
at: '10:00:00'
action:
service: light.turn_on
data_template:
entity_id: light.kitchen_strip
brightness: 200
xy_color: >
{% if states.sensor.met_office_temperature.state|int >=10 %}
[{{0.2309|float}},{{0.2889|float}}]
{% elif states.sensor.met_office_temperature.state|int <= 2 %}
[{{0.3542|float}},{{0.362|float}}]
{% else %}
[{{0.4949|float}},{{0.4202|float}}]
{% endif %}