Jump to content

Motion Sensor Program, repeat "Then" for "X" number of times


Banichi

Recommended Posts

I am using a new motion sensor II to trigger some driveway lights. That part works using the "control" attribute of the motion sensor. What I want to do is get it so that it flashes the lights for a period of time upon motion detection. Ultimately I will want this to work in conjunction with the sunset-10pm timer for those lights in such a way that if motion is detected anytime between sunset-sunrise that they will flash and then return to previous state, (On if between sunset and 10pm, or Off if 10pm-sunrise).

I tried running the trigger as the IF with the below THEN first. Then I tried putting the THEN portion in its own program thinking that the REPEAT command was trying to repeat the entire program with the trigger. Still it won't loop. It'll get through one off and on cycle but that's it. Thoughts?

  • Then
  •         Set Scene 'Scenes / Driveway' Fast On
  •         Wait  2 seconds
  •         Set Scene 'Scenes / Driveway' Fast Off
  •         Repeat 10 times
Link to comment
23 minutes ago, Banichi said:

I am using a new motion sensor II to trigger some driveway lights. That part works using the "control" attribute of the motion sensor. What I want to do is get it so that it flashes the lights for a period of time upon motion detection. Ultimately I will want this to work in conjunction with the sunset-10pm timer for those lights in such a way that if motion is detected anytime between sunset-sunrise that they will flash and then return to previous state, (On if between sunset and 10pm, or Off if 10pm-sunrise).

I tried running the trigger as the IF with the below THEN first. Then I tried putting the THEN portion in its own program thinking that the REPEAT command was trying to repeat the entire program with the trigger. Still it won't loop. It'll get through one off and on cycle but that's it. Thoughts?

  • Then
  •         Set Scene 'Scenes / Driveway' Fast On
  •         Wait  2 seconds
  •         Set Scene 'Scenes / Driveway' Fast Off
  •         Repeat 10 times

Your repeat construct is used incorrectly.

Move the Repeat up two lines and notice  what happens to the format of your program.

I notice you using a scene to operate this light. Does the scene contain more devices that just this one?

If you are using V5 you can save the light level into a variable and then restore it from that variable when you are done.

Link to comment

Ah got it so the repeat operator works as a "repeat the following" and not a "repeat the preceding" as I assumed.

The scene is 3 in-lines in separate pairs of column lights on the driveway linked to a few KPLs.

I like the variable idea though this unit is not on v5. Haven't gotten to play with it much. Is it stable and enough that I can use it at a client location?


Sent from my iPad using Tapatalk

Link to comment
5 hours ago, Banichi said:

Ah got it so the repeat operator works as a "repeat the following" and not a "repeat the preceding" as I assumed.

The scene is 3 in-lines in separate pairs of column lights on the driveway linked to a few KPLs.

I like the variable idea though this unit is not on v5. Haven't gotten to play with it much. Is it stable and enough that I can use it at a client location?


Sent from my iPad using Tapatalk

I would. I consider v5 stable and as finished as any high-tech product I have ever bought.

Link to comment

I've adjusted the repeat command and it works correctly. 

Now regarding the variable. Can I not save the scene's on/off state as a variable in 4.6.2? I don't necessarily need to precise level just on vs off and then pull that from the variable? Or could I not do a second program and have it setup like this:

Program - "Driveway Motion"

IF
        From    Sunset  + 10 seconds
        To      Sunrise (next day)
And Control 'Driveway sensor-Sensor' is switched On

THEN
           Run Program 'Driveway cycle' (If Path)
ELSE
           Nothing

Program - "Driveway Cycle"

IF
     Scene, "Driveway" IS "On"
THEN
    Repeat 60 times
           Set Scene 'Scenes / Driveway' Fast Off
           Wait  1 second
           Set Scene 'Scenes / Driveway' Fast On
ELSE
   Repeat 60 times
           Set Scene 'Scenes / Driveway' Fast On
           Wait  1 second
           Set Scene 'Scenes / Driveway' Fast Off

 

I guess what I'm unclear about is will running the IF path subsequently run the following THEN and ELSE paths as well? 
 

 

Link to comment

No, Else will not run because there is no condition that will execute it. In fact, not even Then will execute because a scene has no state.

Link to comment
On 3/15/2018 at 7:15 PM, stusviews said:

No, Else will not run because there is no condition that will execute it. In fact, not even Then will execute because a scene has no state.

Okay so could the following work:

 

If
        Status  'Devices / IN-LINEs / driveway 1' > Off
     Or Status  'Devices / IN-LINEs / driveway 2' > Off
     Or Status  'Devices / IN-LINEs / driveway 3' > Off
Then
	Repeat 60 times
		Set Scene 'Scenes / Driveway' Fast Off
		Wait 1 Second
		Set Scene 'Scenes / Driveway' Fast On
Else
	Repeat 60 times
		Set Scene 'Scenes / Driveway' Fast On
		Wait 1 Second
		Set Scene 'Scenes / Driveway' Fast Off

So the Else would not run because scene state does not exist. But if I use the state of the devices in the scene as the condition does that adequately function as a condition?

Link to comment
4 hours ago, Banichi said:

Okay so could the following work:

 


If
        Status  'Devices / IN-LINEs / driveway 1' > Off
     Or Status  'Devices / IN-LINEs / driveway 2' > Off
     Or Status  'Devices / IN-LINEs / driveway 3' > Off
Then
	Repeat 60 times
		Set Scene 'Scenes / Driveway' Fast Off
		Wait 1 Second
		Set Scene 'Scenes / Driveway' Fast On
Else
	Repeat 60 times
		Set Scene 'Scenes / Driveway' Fast On
		Wait 1 Second
		Set Scene 'Scenes / Driveway' Fast Off

So the Else would not run because scene state does not exist. But if I use the state of the devices in the scene as the condition does that adequately function as a condition?

Yes but your program will  oscillate as you are affecting the same devices   that you are sensing. Each time you turn a device on and the sensing sees it your program will restart then.. When it turns it off your program will restart Else..

 

What are you trying to accomplish? Get your thoughts and logic together and people can help you. At that stage you may have solved your own questions too.

 

Better to detect the MS by using the if Control MS is Switched on. It can only run the Then section state from the logic. Status will trigger Then or Else.

 

If
...Control of MS is Swtched On
...AND
...From X oclock
...To Y oclock (next day)

then
...repeat 5 times
......Set scene to On
.....set scene Off
.....wait 2 seconds
...repeat 1 times
....leave lights where you want them left with v4
else
......blank

 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...