Cant figure out how to use Xiaomi illuminance sensor?

I have an illuminance sensor that gives a number depending on how bright is it. I want to use this as a switch to allow or deny lights to turn on but I can not figure out how to do it. Yes, I’m a complete noob with Node-red so I’m trying to learn as much as I can…

I think I can get it working by creating a substring that gives a true or a false value based on the number and then uses that as a switch but it seems a bit cumbersome?
Edit: Or maybe it is best to do it as a global variable that i can use in other places too…

What’s your use case? Surely you want the Sensors motion as the trigger and then check the LUX ?

Hi

Yes i want to get a state of the lux and then based on that have a true or false, i solved it by doing a global variable that i can use might not be the smartest but it works…
It gives a true or false based on a set value in the switch

So you are using the sensor to determine whether a light should come on or not ?

This is how I use mine the On/Off switch is not needed you could do that in the event state node and also use trigger for the timer if wished

Regards PATT

how have you setup the “Bathroom Lux” if its an current state i can only get one output i cant get 2?
Can you show it please…

I just use two current state nodes and have the if state set at different values

Change the is as that’s an exact so it has to be 20, so 19 or 21 it will make it not work

PATT

AAAAH Yes now i get it, thank you! im having a slow day :smiley:

No problems :+1:t2: enjoy

PATT

1 Like