I have seen examples online to change a hue or brightness based on the temperature outside, but I am trying to do something different. This automation below works until I have a power loss. I can recognize the power loss in my state of the temperature reading, but then I can only change the color to blue to recognize the power loss. Is there are an easier way to do this with a value template sensor so that I can right an easier code to change the light color based on temperature rather than using triggers for the automation?
See my automation below:
alias: Fountain Box LED Strip Temp ▲
description: Change the light in the box when sensor read an unsafe temp
trigger:
- platform: numeric_state
entity_id:
- sensor.fountain_temp
id: warninglow
above: 66
below: 67.9
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id:
- sensor.fountain_temp
id: dangerhigh
above: 84.01
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id:
- sensor.fountain_temp
id: dangerlow
below: 65.99
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id:
- sensor.fountain_temp
above: 68
below: 82
id: goodtemp
- platform: numeric_state
entity_id:
- sensor.fountain_temp
id: warning high
above: 82.01
below: 84
- platform: state
entity_id:
- sensor.fountain_temp
from: unavailable
to: null
for:
hours: 0
minutes: 5
seconds: 0
id: Offline to Active
condition:
- condition: state
entity_id: input_boolean.automations_kill_switch
state: "off"
action:
- choose:
- conditions:
- condition: trigger
id:
- warninglow
- warning high
sequence:
- service: light.turn_on
data:
color_name: yellow
brightness_pct: 50
target:
entity_id: light.fountain_box_light
- conditions:
- condition: or
conditions:
- condition: trigger
id: dangerhigh
- condition: trigger
id: dangerlow
sequence:
- service: light.turn_on
data:
color_name: red
brightness_pct: 50
target:
entity_id: light.fountain_box_light
- conditions:
- condition: or
conditions:
- condition: trigger
id: goodtemp
sequence:
- service: light.turn_on
data:
color_name: green
brightness: 125
- conditions:
- condition: trigger
id:
- Offline to Active
sequence:
- service: light.turn_on
metadata: {}
data:
color_name: blue
brightness_pct: 50
target:
entity_id: light.fountain_box_light
default:
- service: light.turn_on
data:
color_name: green
brightness_pct: 50
target:
entity_id: light.fountain_box_light
mode: single