Motion / luminance based lighting
Folks,
I need some help on getting this work. I know it's a topic many of you have come across, and despite looking at many examples I do not seem to be getting this right - and I do not understand why.
I have 4 multisensors installed. One is outside to measure luminance, the other 3 are in the living room ('Woonkamer') and are used to measure presence (motion). The idea is simple: if luminance is below a certain value, AND there is motion in the living room, switch the lights on. If there is no more motion, switch the lights off.
I'm trying to achieve this by having two rules
1. One that sets the variable 'woonkamer' to 1 whenever there is motion, and to 0 when there is no motion
2. One that switches the lights in the living room on if the variable 'woonkamer'=1 and luminance from one of the sensors <= 150 lux
Both rules are attached. I'd greatly appreciated if you can have a look to point at what I'm doing wrong in this.
You should do it the other way round: Your luminance rule only runs, when there is a change in the luminance AND it is below 150. Place the variable in the luminance rule and the light switching in the movement rule. The movement rule is triggered whenever there is movement.
Better still, use only on rule as follows:
When movement=any
If movement=on and luminance<150
Switch on
Else
Switch off
You should do it the other way round: Your luminance rule only runs, when there is a change in the luminance AND it is below 150. Place the variable in the luminance rule and the light switching in the movement rule. The movement rule is triggered whenever there is movement.
Better still, use only on rule as follows:
When movement=any
If movement=on and luminance<150
Switch on
Else
Switch off
Hmmm. So I should do it the other way around. But why? It appears I have a serious issue understanding the logic of how Zipato has designed this. My rule says:
WHEN luminance < 150
IF movement=on
Switch on
Else
Switch off
In my view, the result should be the same. With the difference being, that I would expect my code ONLY to run if it's dark, where code posted above is always evaluated even when it's light (which seems inefficient). But my code doesn't work, so I must be misinterpreting how the Zipate Rules work.
What I particularly have trouble grasping is why you are writing the 'WHEN movement=any' at the top? Why is that. And to what sensors should it relate, all 3 living room sensors or just one?
Finally, I was wondering: will in your example the rule also switch the lights OFF when luminance comes above 150 while you are in the living room?
Hmmm. So I should do it the other way around. But why? It appears I have a serious issue understanding the logic of how Zipato has designed this. My rule says:
WHEN luminance < 150
IF movement=on
Switch on
Else
Switch off
In my view, the result should be the same. With the difference being, that I would expect my code ONLY to run if it's dark, where code posted above is always evaluated even when it's light (which seems inefficient). But my code doesn't work, so I must be misinterpreting how the Zipate Rules work.
What I particularly have trouble grasping is why you are writing the 'WHEN movement=any' at the top? Why is that. And to what sensors should it relate, all 3 living room sensors or just one?
Finally, I was wondering: will in your example the rule also switch the lights OFF when luminance comes above 150 while you are in the living room?
I have now updated the rules as follows. Personally, I'd welcome any suggestions to make this more workable/readable, in short: more elegant code (as I find it horrific and hard to understand this way). But would this work?
I have now updated the rules as follows. Personally, I'd welcome any suggestions to make this more workable/readable, in short: more elegant code (as I find it horrific and hard to understand this way). But would this work?
I would do it this way:
Greetings to the NL,
Jan
I would do it this way:
Greetings to the NL,
Jan
Thanks @Jan & @Tim - this has been a great help. I've fiddled quite a bit with this. In the end I now have a working setup with two virtual switches:
1. Presence living room
Switch is set to ON when one of the three motion sensors is tripped, to OFF if all three state no motion
2. Daylight
Switch is set to ON when luminance from the sensor outside exceeds 150 lumen, to OFF otherwise.
Rule to switch the lights on then as follows:
WHEN 'Presence living room' ANY OR 'Daylight' ANY
IF 'Presence living room' ON AND 'Daylight' OFF
'Lights living room on' RUN SCENE
ELSE
'Lights living room off' RUN SCENE
That's it. Works like a charm, were it not that one of the 3 motion sensors (Aeotec Multisensor 6) does not properly detect motion (ceiling mounted setup). Other sensors (Aeotec Multisensor 5) work fine.
@Jan - looking at your rule I suspect it would not turn on the lights when you are already at home and it turns dark. For that, you also need to include the luminance sensor in the WHEN statement, at least if my understanding is now correct.
Thanks @Jan & @Tim - this has been a great help. I've fiddled quite a bit with this. In the end I now have a working setup with two virtual switches:
1. Presence living room
Switch is set to ON when one of the three motion sensors is tripped, to OFF if all three state no motion
2. Daylight
Switch is set to ON when luminance from the sensor outside exceeds 150 lumen, to OFF otherwise.
Rule to switch the lights on then as follows:
WHEN 'Presence living room' ANY OR 'Daylight' ANY
IF 'Presence living room' ON AND 'Daylight' OFF
'Lights living room on' RUN SCENE
ELSE
'Lights living room off' RUN SCENE
That's it. Works like a charm, were it not that one of the 3 motion sensors (Aeotec Multisensor 6) does not properly detect motion (ceiling mounted setup). Other sensors (Aeotec Multisensor 5) work fine.
@Jan - looking at your rule I suspect it would not turn on the lights when you are already at home and it turns dark. For that, you also need to include the luminance sensor in the WHEN statement, at least if my understanding is now correct.
Yes, that's correct.
Yes, that's correct.
Replies have been locked on this page!