Hi,
within a node-red flow, I’m trying to turn on some lights if the value of a luminance sensor is below a certain threshold.
I used a “call service” node for the lights.turn_on
part.
Strangely, the auto completion for domain (“light”) and service (“turn_on”) for this node does not propose “light” as domain value - does anyone have an idea why that might be?
Anyway, I entered the values manually regardless and turning on my light this way works.
So next, I used a “current state” node to get the luminance value from the sensor.
This one has a “halt if” property, but I suppose, I can’t use something like “< 5.0” in there?
To piece things together, I now added a function node between the sensor state and the service call, containing:
if (msg.payload < 5.0) {
return msg;
}
return null;
Is that the way this is supposed to work? Or am I missing something here?
Piping the message through a function node for a simple comparison seems overly complicated to me.
Sebastian