This object is in archive! 

motion sensor activation between 19:00 to 07:00

Mikael Andersson shared this question 8 years ago
Need Answer

I need help with creating a rule for a wall plug I have a motion sensor and a wall plug connected to a lamp, I want to have it so when something moves and activate the sensor it sends a command to wall plug to turn on, and after 200sec if nothing have moved a front of the sensor it turns off, but if something have moved affront of the sensor it starts the timer from 0 agent and starts from the beginning agen, and this rule should only be activated between 19:00 and 07:00 can somebody help me? This should run every day


### Sorry about my Spelling I'm Dyslexic ###

Replies (9)

photo
1

@Mikael,

You need two rules for this. First of all, you need a CountDownTimer which will turn OFF the lamp when the timer reaches Zero. For this, you can use a WHEN with a Schedule which runs once every minute, always.

Inside this, you will need to check if CountDownTimer = 1, then you switch OFF and set CountDownTimer to 0. If CountDownTimer is greater than 1 you Decrement this variable. (During DEBUG you PUSH a message to yourself)


In your second rule, you will trigger when MOTION is ACTIVE.

Inside this you will check that Hour of NOW > 19 or Hour of NOW < 7. If so, you will check if MotionTimer < 1. If so you will switch ON the light. (there's no need to switch on again at every motion).

In any case, you will set the MotionTimer to 3 (minutes).


Hope this helps (this was quick and dirty and may contain errors; I have something similar working in an office environment).


Best regards,

Robert

photo
1

Hi Mikael,


Find attached a similar rule to your needs. In the rule I use an Aeotec multisensor to detect motion and measure luminance (Instead of schedule) and a fibaro RGBW module. If your motion sensor is also a luminance sensor you can use the same rule. If not, then you will have to remove the luminance check and change it to something like the second attachment.

photo
1

Mikael,

I have enclosed the rules I have for a location: Whenever the door is opened, light turns ON and a timer is set for 3 minutes. If motion is detected while light is ON, the timer resets to 20 minutes. If the timer reaches 1, light is switched off. This means that the light turns OFF 3 minutes after the last person leaves the area, but that the light stays ON as long as there is movement within 20 minutes of the last movement.

photo
1

I would try it this way in one rule with only one join (see attached file). Sorry that I couldn´t try it out for you but the system is far away.

Files: Lamp.png
photo
1

If you have time and can you please remake the rule but in English?

photo
1

My second rule is in english, the only difference is that Klaus rule only runs when the sensor changes from "No Motion" to "Motion", my rule runs every time the sensor changes state.

photo
2

Hi Mikael,

sorry, I´ve got no time right now to do it with those puzzle tiles so I translated just the content. Hope it is enough to understand the idea.

If Motion

Join

If Motion and (Time of (now)) between (time of (19:00)) and (time of (07:00))

Lamp Action On

Else

Wait 200

Lamp off

photo
1

Hi Klaus, do you have any suggestion if the rule should be controlled by luminance also?

photo
1

No problem at all: just add anonther "If"

I had the same idea and started with the fibaro motion sensor which measures luminance. The problem is that you have to update luminance quite often to get reliable data (which costs battery live) and that I didn´t find the right threshold (sometimes 5 was ok, somtimes it was to dark or to light)

So I created a variable "daylight" which by scheduler becomes "1" 30 min after sunrise and "0" 30 min before sunset (I found that a good compromise because it is darker within the house) and use that variable for some other rules as well. Only problem: After a reboot the variable is "0" so you have to wait for the next sunrise/sunset or a new tile which is excecuted after a reboot ;-))

Left side is the solution with a variable (one rule for the variable and one to implement in your motion sensor rule) and right side the luminance solution which I wouldn´t recommend.

Klaus


PS I just added both schedulers (Planer in German) to make it easier to understand

photo
1

do you mean something like this?

photo
1

Hi Mikael,


that should work if you are content with fixed hours. I´d rather use a virtual weatherstation and use (time of (sunrise) and (time of (sunset)).

photo
photo
1

Mikael,

You should definitely go with the suggestion from Klaus Gimme. It will solve your problems, and is very much simpler and straight forward than my (very much more complex) example. It is in fact a great example on how easily such situations can be dealt with.

Best regards,

Robert

photo
2

Hi! Here is a simple rule for that. you can watch the zipato youtube chanel for an build example

photo
1

how do you exclude weekend days (or other)? i have tried but no luck

photo
1

That´s easy. Use a scheduler to set a variable. I use a similar rule to set a variable to "detect" daylight (I set it to "1" 30 min. after sunrise and back to "0" 30 min. before sunset.

photo
1

can sombody explaine wwhat the building block in rules white the name join, what do it have fore functio?

Leave a Comment
 
Attach a file