Day/night code for node red

Home Assistant automation projects, questions, etc. go here.
Post Reply
professionalcynic
LED-Curious
LED-Curious
Reactions:
Posts: 5
Joined: Mon Apr 05, 2021 3:22 am

Has anyone figured out how to integrate a day/night target based on a light sensor input into the node red code from the videos?
professionalcynic
LED-Curious
LED-Curious
Reactions:
Posts: 5
Joined: Mon Apr 05, 2021 3:22 am

Had a go but can't get it to work?

var target;

if (msg.payload["lightsensor"] <= 10){
target = msg.payload["ntemp_target"]
}else{
target = msg.payload["temp_target"]
}
if (msg.payload["average_temp"] < (target - msg.payload["temp_tolerance"]))
{
return [msg, null];
}else{
return [null, msg];
}
Post Reply