Page 1 of 1
Use lux sensor with motion sensor
Posted: Friday 26 May 2017 23:13
by anno
The code is working if i use sunset and sunrise
But i now want to use the lux sensor. But i can't get it working.
The lights go not on and when i use the =/ and i hold a light on the lux sensor. So the lux sensor is above 2 lux, the lights still go on????
So no lights with >< and lights on when =/ with every lux and motion????
Re: Use lux sensor with motion sensor
Posted: Friday 26 May 2017 23:27
by jvdz
Well the ElseIf will always be true when the Buitenlicht lux sensor is greater than 0 so the light will be switched on.
What exactly is the intent for that ElseIf test?
Jos
Re: Use lux sensor with motion sensor
Posted: Friday 26 May 2017 23:32
by anno
it is comming from the sunset and sunrise. but even without the elseif. I get the same results.
Re: Use lux sensor with motion sensor
Posted: Saturday 27 May 2017 15:57
by jake
In your last elseif the light value is always accepted, except at value 0
Are you sure that your minimum value of 0 or 1 isn't too low? Even your outdoor light could increase this small number.
Re: Use lux sensor with motion sensor
Posted: Saturday 27 May 2017 21:51
by anno
yes i am sure. my outdoor light don't effect the light meter. And it is so dark here that i don't have any light at night. So how do i make it than. The lights need to go on at 0.
Re: Use lux sensor with motion sensor
Posted: Saturday 27 May 2017 22:57
by anno
This one is not working

- not working.jpg (55.11 KiB) Viewed 3512 times
this one is working

- working.jpg (99.42 KiB) Viewed 3512 times
This one is working at down and the lights didn't go on at day. But this blocky is al working with a 7 lux and less from the light sensor.

- workingat down and light go not on at day.jpg (162.33 KiB) Viewed 3512 times
Re: Use lux sensor with motion sensor
Posted: Saturday 27 May 2017 23:04
by anno
Log from the tuinverlichting this day.

- logtuin.jpg (46.14 KiB) Viewed 3510 times
Re: Use lux sensor with motion sensor
Posted: Saturday 27 May 2017 23:25
by tozzke
the first one isn't working because you've got the wrong if-block. If you're using only 1 if statement, you should use the one without the blue icon on the upper left corner.
the ≠ blocks won't get you your desired result. It literally means 'not equal to', so if the value of 'Buitenlicht actual' isn't 1 (which is very likely it isn't), it triggers. So it'll trigger pretty much always when motion is detected.
I think you're looking for something like this (If-block WITHOUT the blue icon):
Code: Select all
If [ [ [ [Terras bewegingsmelder = On] or [Oprit bewegingsmelder = On] ] or [Schuur bewegingsmelder = On] ] and [Buitenlicht] actual <= [5]* ]
Do [Set [Tuinverlichting] = [On]]
[Set [Tuinverlichting] = [Off] After [300] seconds]
*
I chose 5 because 1 seems very little light to me, you should see what value the light sensor gives when you think it's dark enough for the light to go on at movement
So all the movement sensors in or-blocks and those combined in an and-block with the lux value of the current light sensor
PS: do your motion sensors have a built-in lux sensor? because you say your last blockly pretty much works as you want and doesn't trigger during the day. Which is odd because during the day the lux value certainly isn't equal to 1
Re: Use lux sensor with motion sensor
Posted: Saturday 27 May 2017 23:32
by anno
the <= and or >= are not working ether. I already attempted that.
I will try to use the if without the blue icon
ps. no my motion sensors don't have a build in lux sensor. I use a mysensors lux sensor. And indeed it is wierd that the tuinverlichting blocky is somewhat working. no the lux is far above the 1 during day especially today.
Re: Use lux sensor with motion sensor
Posted: Sunday 28 May 2017 0:04
by anno

- tuin.jpg (74.72 KiB) Viewed 3494 times
Re: Use lux sensor with motion sensor
Posted: Sunday 28 May 2017 9:19
by mrf68
As far as I can read this last Blockly example, it will always turn on the lights whenever movement is detected. When "Terras bewegingsmelder" is ON, the statement is TRUE and it does'nt matter what the other conditions are. The same goes for "Schuur bewegingsmelder", if it is ON, again the statement is TRUE and the lights will turn on, etc.
You say it worked with <Sunrise and >Sunset, so every change from there should be inspected. And sure, when part of the condition is "Buitenlicht /= 1" ,as mentioned in a previous post, it will always be TRUE, except when the value is exactly 1, so if lux = 0 or 7 or 85 or whatever except 1, it will trigger.