Stop lighting flow from flicking on and off, lux sensor

Hi all Homies!

So I have this 433 MHz lux sensor that I use to turn on and off a set of indoor lights (and outdoors ones) at a specific value of outdoor light. This works pretty good most days but on some days when the light conditions are varying around my chosen value the lights can turn on and off several times during a short period of time. This is a bit annoying and might make my neighbours think I’m going crazy.

Is there a function in Homie like ”drift”? I.e. that a value have to change a certain amount to be valid again. Lets say I set my lux value at X and activate the function ”Drift” to 5. Then when the lux value has reached X Homie ignores if the value changes +/-1, 2, 3 and 4. When the value is X+/-5 it reacts again.

With a function like this I think the flow would not turn the lights on and off if the value is hovering around X. When the sun is setting on a partly cloudy day the lights turn on if there is a cloud passing in front of the sun. When the sun comes out again the lights turn of and so on until the sun has set enough for the sensor value to be constant under X.


You could set up two flows. One turns the lights on when the lux fall below x - 5 and the other turns the lights off when the lux is above x + 5.

I have two flows…hence the turning on and off. I don’t really see the need to have X - 5 and X + 5…I can just as easy use just X and X - 10 (or X + 10).

“X” in this case is a subjective value based on when me and the wife feel like its getting dark inside the house. To be honest, the sensor isn’t even reporting Lux…it’s reporting C° since it is a converted temperature sensor. (I omitted that information since it’s not really important for the question and I thought it would be a bit confusing. :blush:) So in my flow I have “When:” “Temperature becomes less than 20 °C”. “Then”: Turn on lights". The second flow is reverse: “When:” “Temperature becomes greater than 25 °C”. “Then”: Turn off lights". (Please read Lux instead of temperature.)

I could use time and date, or even use sunset/sunrise to constrain the period this flow to be active but I really like when the house lights up during daytime if there is a really dark storm cloud looming and that the lights turns off when it passes if the ambient light is enough…we are talking automation here right? :wink:

To summarize: I want the lights to be as close to 100% independent as possible. The light sensor sends its value to Homey and I tell Homey that when the ambient light is under value X the lights should be turned on and if it’s over X (or Y) they should be turned off. Time of day and season should not matter. If the value is fluctuating around X (or Y) Homey should chill for a moment to see if it’s just a temporary change in value before sending the appropriate command so there is no light show with blinking lights.

I also use 2 flows: one to switch the lights on the other to switch them off (with a small offset, see below)

I prefer multiplying over adding because I also change the lux levels

I created a logic variable (WK is donker lux) that sets the lux level.
This has 2 advantages:

  1. Since you probably need to play with the lux value to get it right, thats easier to change one logic variable than in all flows (remember you have at least 2 flows using this value)
  2. I can control the value of the logic via flows. When I am not at home the light can go on at a different lux level. When the cleaning lady is in the house she needs more light so I set the lux higher
1 Like

Another way is to “pause” the flow. Not the best solution, but just simple to use to decrease the switching moments.
lux trigger
lights on
And then…
disable the flow
And then…
enable the flow with a delay of X minutes


When theres a lot of clouds the light still keep going on and of.
So like peter Kawa proposed I also temporarily disable the “lights off” flow.
Not by flow control but via a “AND”
In the AND section I check on the variable


In the lights On flow I set and reset the value


(I dont disable the light on, I do not want to sit in the dark so accept switching for that

1 Like

For this, I use a routine that flattens the curve:

Rem: “buitenlicht.gem” is a numeric variable.
The second card is not functional for this routine (test variable).


I’m using a shift register to flatter the curve:

The flow is triggered each second minute. So the average lux is over the last 10 minutes.

1 Like

Thanks guys!

I see different solutions that seems to do what I’m looking for. Unfortunately I don’t know Dutch (even English is not my native language) so I can’t really do that much with the information.

Thank you anyway for your effort. :slightly_smiling_face:

Google can translate for you.

I use 6 flows and 2 variables to control the light:

  1. WHEN the sun sets in 30 minutes, set variable house_light_sunset to Yes.
  2. WHEN the sun rises, set variable house_light_sunset to No.

This is to manage when it’s time to turn the light on or off. That way I can also use X minutes before sunset in the AND later.

  1. WHEN the lux changes AND the lux is lower than X AND house_light_sunset is Yes THEN set house_light to Yes.

  2. WHEN the lux changes AND the lux is higher than X AND house_light_sunset is No THEN set house_light to No.

  3. WHEN house_light changes AND house_light is Yes AND someone is home THEN Turn light on.

  4. WHEN house_light changes AND house_light is No THEN Turn light off.

As a fairly new user to Homey this was the best I came up with. :smiley:

I build in 2 solutions to prevent flikkering.

  1. a variable “anti-pendel” (anti-flick”) that prevent light to switch of by lux for a period of time
  2. an offset so the light does not go off at the same lux as it goes on. (Since lights go on lux will increase…)

I create the offset by multiplying and not adding because I also vary the luxlevels That determine on/off
(When the cleaninglady is the required lux level is higher)

As a matter of interest, I’m just about to install a lux monitor, which direction do peeople find berst for the sensor to point?
Pointing it South will give everything from direct sunlight through to dark, North will give an attenuated flatter curve. What works best in prectice for applications like the foregoing?

Not the answer you are looking for but:
If you have 2 lux sensors you can use the “group app” and then use the “max” or “min” value of both to trigger the flows.

Best of both worlds (/directions)

1 Like

This is a tricky one.

I want my lights to turn on at a certain outdoor lux level since the outside light is what makes it feel dark or bright indoors. A complicating factor is that we have outdoor lighting that aslo is controlled by a flow, so I really need to find a perfect spot for the sensor so it’s not affected by the facade light or any other of the lights in the garden.

I have chosen to place the sensor under the roof overhang on the north east side facade of the house. This way it’s never subjected to direkt sunlight only indirect light which means I have to use a pretty low value as trigger in the flow . However, some times there is this weird phenomena that when it’s really bright sunlight the value drops below the trigger. I have not been able to identify what makes it behave like this and it feels really stupid that the indoor lights turn on when the house is bathing in bright sunlight.

What a simple but brilliant idea, thanks