Trigger if luminance is some delta level over long term average for a duration of X or less seconds

Use Case
Luminance sensor, semi-outdoor, being averaged by Averaging Plus ( thanks @bptworld )
Want a trigger in RM (w/ Required Expression - night mode) on any reading level some prescribed delta above that average

But... want to filter out lightening events which I'm satisfied with assuming are of duration 2 seconds or less (vs illumination by flashlight or headlights we'll assume are OVER 2 seconds in duration.

Am I going to get the granularity of time & evaluation necessary, and is a WAIT in a Conditional Statement the way to do this?

I haven't taken the plunge just yet, but it appears the latest update has a trigger capability for just this type of use...


More like, trigger Illuminance > X and Stays that way for 2 seconds. That will not trigger for brief illuminance excursions over X, only for one that endures.

To clarify:

As @dylan.c mentioned Sticky Trigger, nice feature...

Using that -
would the prescribed level threshold start the evaluation
and then the count to 2 seconds would proceed
AND IF the level was still over the threshold by the end of that time window I'd get a triggering?

Even as short as 2 seconds this would work (assuming it might actually have some overhead that pushed it to 3) ?

EDIT: Hold the bus I just remembered that this device isn't even updating that's giving a new value no faster than every 7-8 seconds at best. So I guess if I employed this I'd have to be satisfied with catching say 8-10 seconds of illumination bump over the average. That could be enough to alert to headlights or a flashlight shining on/in and avoid the false triggering by lightening.

Question still stands if Sticky Trigger is the tool.

It will do what you want, assuming the device values and update times work for you use case.

1 Like

I had a similar issue with luminance. I ended up putting the sensor on the North side of the house away from the street.

I turn the lights on when the Lux falls below some number say... 10 AND a boolean is "BRIGHT"
At the same time I set that boolean to "DARK" (I use bright and dark here for explanation only)

Then I have another Rule that sets the boolean to BRIGHT when the lux reaches 6000.

Seems to work fine for me. It would likely be able to ignore flashlight and headlight issues if they didn't go above 6000.

Thanks for the brief on what you've done. In this case I actually WANT to trigger on flashlight & headlights as neither should be illuminating this area on the property unless it's me. What I did want to avoid is lightening flashes causing unwarranted triggering.

According to google a long lightning flash is 200 ms. I wonder if a lux sensor will sense and respond to that short a duration. You might want to try a test and see how fast you have to pass a high intensity flashlight across your lux sensor to have it respond and send a message to the Hub.

I have a "Mijia Lux Sensor" and since it is battery operated it only responds periodically.