Trying to detect when a DS18b20 goes offline or NaN and then execute a LED based on the state
I have referred to this post: https://community.home-assistant.io/t/sensor-nan-value-as-trigger/480230/4?u=domain_int butI really need to add an else in the statement and dont know how to do it
I tried doing this:
then:
- if:
condition:
lambda: (id(temp_probe_error).state)) == "NaN";
then:
- light.turn_on: sensor_check
else:
- light.turn_off: sensor_check
tried this
- lambda:
if (isnan(id(temp_probe_error).state)) {id(sensor_check).turn_off();} else {id(sensor_check).turn_on();}
and I tried this
- platform: dallas_temp
name: ${name}-probe-error
update_interval: 10s
id: temp_probe_error
on_value:
then:
- lambda:
if (isnan(id(temp_probe_error).state)) {
id(sensor_check).turn_on();
} else {
id(sensor_check).turn_on();
}
I am a newb when it comes to lambdas but am not afraid to search
The main issue is to do with the else statement
Hope someone can help