Light sensor values changing frequently

Hi, first post here from a new user.

I have Ener-J lights throughout my home all working well through Apilio and the Tuya/Smartlife integrations.
I have recently purchased a light sensor (BENEXMART model on Amazon).
I setup the device in the Smart Life app and it’s detecting light conditions without any issue (a LUX reading from 0 to 1000 where 0 is dark and 1000 is very bright light).

So my scenario is that I have the light sensor in my hallway and if the LUX reading goes below let’s say 30lux (which means it’s dark) I want to switch on the hall lights.
I’ve created a boolean “is_hallway_dark” which gets updated by a condition.
The condition is configured based on the lux value of the TUYA light sensor being less than a value of 30 (so it’s reading the light sensor value).
I have a logicblock that uses a CRON based time trigger (every 15mins) and checks if the “is_hallway_dark” boolean is True. If it is then set a scene in TUYA/Smart Life using Apilio.
It all works well however my question is about the rate of change of the sensor values.
I see event logs every couple of seconds now as the light reading is constantly changing by 1 or 2 lux.
While my logic block is only set to trigger every 15mins in order to limit the amount of “work” being done I’m a bit concerned by the amount of times the condition is being evaluated due to the rapid changes in the light sensor values.
I’ve tried using the delay option in the condition for 5min to see if it slows down the processing but it doesn’t.
I suppose the only way to resolve this would be is there was an option to adjust the sensor calibration but there’s no option to do this on it (e.g. an interpolation type setting to “smooth” reading values).
Do you know if my scenario will cause any issues in terms of system performance based on the rate of condition checking/evaluation being done or is there something I’ve missed that would be a better way to handle this scenario?

Many thanks and sorry for the long-winded post.

Joe

3 Likes

Joe

Welcome to the community, and thanks for giving me another name to search for TUYA products.

I have the same light sensor under a different name.

@pebneter will confirm but what you are seeing is what Apilio sees from Tuya and unless you have set it to trigger the logiblock it shouldn’t matter. If you use the delay say for 5 minutes then Apilio will note that and not effect any changes to the logiblock

I have mine set to bright value less or equal than and the logiblock is checked by a motion sensor. for the hall way with a 10 minute delay for the living room as the living room is triggered by brightness. (2 conditions one to trigger one not to trigger)

I may be wrong on my assumption but Philipp will confirm

1 Like

Thanks Drivingforce,
Good to hear your setup for this also.
Yeah that’s it - I only trigger the logicblock evaluation every 5min (via CRON) which reduces the amount of times this will occur as otherwise the light sensor would trigger it far too often.

Rgds,
Joe

Hi @joe.ferris,
thanks for your thoughtfulness and posting a great question here.
If the sensor sends data (in the case of your model it’s around every 5-15 seconds) it is received and stored - so that “load” happens in any case and should not be something you have to worry about.
If you have set the condition to “triggering” there is of course some data processing that occurs after each update. Compared to the overall process cost, this does not add a lot of load.
But as @Drivingforce, you’d probably want to add a delay to the condition so that it does not start rapidly toggling if the brightness is just around the threshold.

So to summarise, you can do either way (with a timed job or a triggering condition with a delay) and the system load impact would be about the same.

2 Likes

Hi @pebneter,
Thanks for confirming and for your info.

Rgds,
Joe