I’m having trouble getting an automation I want to set up to work properly. The goal is to have the light change color based on the precipitation probability.
Here is what I have right now:
alias: "Light based on weather"
trigger:
- entity_id: sensor.dark_sky_precip_probability
platform: state
condition: []
action:
- service: light.turn_on
data_template:
entity_id: light.lamp
brightness_pct: 100
rgb_color: >-
{% if states.sensor.dark_sky_precip_probability.state | int < 30 %}
[255,255,102]
{% elif states.sensor.dark_sky_precip_probability.state | int < 60 %}
[102,255,255]
{% elif states.sensor.dark_sky_precip_probability.state | int < 90 %}
[51,153,255]
{% else %}
[0,0,204]
{% endif %}
alias: "Light based on weather"
trigger:
- entity_id: sensor.dark_sky_precip_probability
platform: state
condition: []
action:
- service: light.turn_on
data_template:
entity_id: light.lamp
brightness_pct: 100
rgb_color:
- {% if.... %} first value R
- {% if.... %} second value G
- {% if.... %} third value B
It’s not very nice, but it’s a limitation of yaml.
Yeah, pretty much. I can’t say for certain it works, but people I have helped have said it works. I don’t have any rgb lights. All we are doing here is taking the rgb field from this: