Change RGB Color depending on outside temperature?

Hi
Could someone please give me an example on how to change the RGB color depending on the outside temperature, ie:

-10 White
-10 - -5 Light blue
-4 - 0 Blue
0 …

Also, does anybody know if there are any official color scales for temperature? I’ve tried googling but I end up with sites describing Kelwin and not RGB values.

Probably the easiest way would be something like this:

automation:
  - alias: Change color per outside temp
    trigger:
      platform: state
      entity_id: sensor.yr_temperature
    action:
      service: light.turn_on
      entity_id: light.my_light
      data_template:
        color_name: >
          {% if trigger.to_state.state|float <= -10 %}
            white
          {% elif trigger.to_state.state|float <= -5 %}
            lightblue
          {% elif trigger.to_state.state|float <= 0 %}
            blue
          {% elif ... %}
            ...
          {% endif %}

Find color names here.

1 Like