This object is in archive! 

how can a rule make a motion detector first check if the light is already on?

Gratje shared this question 7 years ago
Need Answer

HI,


I just received my zipabox. and started playing with 1 wall switch and a motion sensor.

the light that i'm switching is in my living room and can be on whle watching tv or something else.

next to the house i have a motion sensor, that needs to trigger the ligtht in the living room for 60 seconds and turn it off. but It only when the light is switched off. that means i'm not watching tv.

I can make it switch at the moment. but even if the light is on or off. it will switch it off after 60 seconds.

how can I build a check like:

motion sensor detects something.

is the light already on in the living room?

no? turn it on, and turn it off after 60 seconds.

yes? do nothing and leave light on.

Comments (18)

photo
1

I would...

When motion detected

If light is off

Action turn light on

Wait 60s

Action turn light off

photo
1

when motion any? or when motion is on?

motion any, will say if there is a change in state right?I'm using a philio tech psm02 sensor. sensor detects movement and stays active for 24 secons (8*3=24 minimum)

photo
1

Without knowing you sensor i guess you want ON only. Since if you set ANY you will get a trigger both when sensor gets active and then again after 24s when its deactivated. Do you really want that?

photo
1

my sensor gives an on or off statement. this stays on for minimum of 24s.

or is it better to make 2 when statements:

1. when light is on -> do nothing

2. wehen light is off -> if sensor is triggered, turn light on, wait 60s, turn light off.

photo
1

No, do nothing is not required.

photo
2

This rule is working fine for me,

photo
1

Lars, what kind of sensor do you use for the light? i'm using a philio psm02, and it is displaying luminance in percentage. does your sensor do the same? or is it in lumen?

but with light off I mean the real light/lamp.

If that light is already on when the motion sensor is triggered it means i'm watching television with that light/lamp on. If that light/lamp is on, and the motion sensor is trigged it has to stay on.

the light/lamp only has to be triggered by the motion sensor when the light/lamp is off.

photo
1

Just put the


If Light=off

then turn Light = On

in there.

photo
1

And Philio sensor is displaying % (0 to 99%)

photo
1

I try this one time more.

turning on the light is working. but turning it off is not working.

I made a screenshot of both rules. turning on the light, and turning off the light.

The problem is when i want to turn it of, it is not if the light is on.

My light gives a state on or off when it is switched. but inbetween not.


so if i start the rule with:

when light is on. how can the rule check if the light is really on or off?


so the main question, is there an option that a rules checks the state of the ligth/rollerblind etc. when the rule is starting.

Files: rule.png
photo
1

So if the time is between 02.00 and 16:30 and the lamp is on you want to turn it off?


U can use the scheduler for this and check every x min. but don't make to many rules with this (CPU load).

photo
1

but how does it check it? because my Everspring AN158 is only sending its state when the light is switching. so if the light is turned on by the first rule. it sends the state "ON' one time. how does the second rule know the light is on? because the state will not change.

photo
2

HVZTmRFxlfEuHksSkEjeLike this (not tested)

photo
1

that works like a charm. but i still don't understand why it is working with a scheduler. and not working without. because when I change:

when -> scheduler (configured)

to:

when -> light is on.


the when light is on. is not working. but if I "check" it with the scheduler it does check the state of the light.

photo
2

You need a trigger to trigger/start the rule.


But the state off the light is not changing so it is not triggering the rule.

photo
1

completely clear! and I noticed I can use the schedule function together with a timespand.

when -> schedule AND time now is between... and ...

is also working.

photo
1

Geert V. wrote:

Lars, what kind of sensor do you use for the light? i'm using a philio psm02, and it is displaying luminance in percentage. does your sensor do the same? or is it in lumen?

but with light off I mean the real light/lamp.

If that light is already on when the motion sensor is triggered it means i'm watching television with that light/lamp on. If that light/lamp is on, and the motion sensor is trigged it has to stay on.

the light/lamp only has to be triggered by the motion sensor when the light/lamp is off.

Sorry I missed your question.

I'm using the Aeonlabs 4-1 multisensor and it is reporting in LUX. 0 to 1000LUX.

photo
1

Lars,


I needed a check (lookup)

if lightbulb is on> turn lightbulb off

but if lightbulb is already off. do nothing.


only the state of the lightbulb was only send when I switch the lightbulb.

so I needed to lookup the condition of the lightbulb (is it on or off).

fixed with the scheduler.