Jump to content

Wait Command not working


Recommended Posts

I'm not sure if I'm doing something wrong or if I found a bug.   I have a motion sensor in my garage that automatically turns on the lights.   I've been trying to modify that program so that if motion still exists the lights don't turn off.   I put a wait in front of the next program call but it doesn't wait the 4 minutes, it automatically calls the program.

 

It's a bit more complicated as I want to tie in other trigger points as I have several other garage doors that could open and trigger the lights.   Once there is no motion, the lights turn off.

 

This is the basic program:

------------------

Motion Detection:

 

If

Status 'Garage Motion Detection' is On

 

Then

Run Program 'Motion - Garage Talk' (IF)   ## This is a program to alert if there is motion in middle of night that shouldn't be there.

Run Program 'Motion - Garage Lights' (Then) ## Program to turn on lights

$Motion_In_Garage = 1

Wait 90 Seconds

 

--------------

Program Motion - Garage LIghts

 

If

No conditions

 

Then 

Set ' Garage LIghts' On

$Garage_Lights_On = 1

Wait 4 Minutes

Run Program 'Motion - Garage Motion Off' (If)

The above two lines are my issue.   It automatically calls this program, there is no wait executed.

 

------------------------

Program - Garage Motion Off

 

If

Status 'Garage Motion Detection' is Off

 

Then 

$Motion_In_Garage = 0

Run Program ' Motion - Garage Lights Off ' (If)

 

Else

Wait 5 Minutes

Run Program 'Garage Motion Off'

 

Again, the program doesn't wait 5 minutes on this else statement.   It automatically runs the if above once the Off is reached.   I realized that this is a conditional If after reading and will need to adjust this if for other conditions but why isn't the wait command delaying other programs?

 

Link to comment

Do you have the MS set to send an On only. Any time the status changes, a wait is cancelled. Also, you may want to use Control instead of Status.

 

I don't think On only is enabled but not positive yet.   I cannot push an update to the MS, so that might be one of my issues.   The jumpers are 1 on, 2-4 off, 5 on.   If it turn 5 off, the MS has a longer wait time (manually adjusted) but I cannot adjust the wait time with 5 on.

Link to comment

If jumper 5 is on, all manual settings are ignored. But, the concern is that you can't set the MS from the Admin Console. What is the firmware and UI that you are running on the ISY? Which ISY?

Link to comment

Do you have the MS set to send an On only. Any time the status changes, a wait is cancelled. Also, you may want to use Control instead of Status.

 

Even though the wait is canceled, it shouldn't be bypassed correct?  The programs being called after the wait are automatically called skipping the wait.

Link to comment

Even though the wait is canceled, it shouldn't be bypassed correct?  The programs being called after the wait are automatically called skipping the wait.

 

Technically Stu is correct, but its more than the 'wait'... when the logic of the 'If' is no longer true, the entire program stops dead in its tracks.

 

Paul

Link to comment

Do you have the MS set to send an On only. Any time the status changes, a wait is cancelled. Also, you may want to use Control instead of Status.

 

But only if they're Insteon Motion Sensors, :) Also he actually runs the "if" of a motion detect program. If he used CONTROL then the "if" would fail whether the sensor was on or off.

 

It's possible the new Z-Wave Plus devices may respond to CONTROL like the Homeseer Z-Wave Plus switches do.

Link to comment

The motion sensors are Insteon.   I was able to push the options down after putting the MS in communication mode so I fixed that issue.  

 

I switched from Status to Control, programs perform the same which is a completely different topic to the wait issue.

 

 That doesn't make sense to kill the program when the IF conditions are no longer met.   It should be If then or If Else...    Not if Then while if is true. 

Link to comment

Such is the beast with event programming. It's a little different than regular flow type programming.

 

I've re-read the OP a few times and it seems like you want to turn on the lights when there's motion in the garage and turn them off when there's no motion.

 

If that is the case, program your motion sensor to send ON and OFF, set a timeout of xx minutes then your program is simply

 

if

     status motion sensor is ON

then

     turn on lights

else

     turn off lights

 

The MS (and the lights) will stay on as long as it detects motion and will send OFF (to turn off the lights) after the timeout period of no motion.

Link to comment

The motion sensors are Insteon.   I was able to push the options down after putting the MS in communication mode so I fixed that issue.  

 

I switched from Status to Control, programs perform the same which is a completely different topic to the wait issue.

 

 That doesn't make sense to kill the program when the IF conditions are no longer met.   It should be If then or If Else...    Not if Then while if is true. 

 

If you use Sense, then the program does run Then when true and Else when triggered false.

 

BTW, the 90 second wait in the first program doesn't accomplish anything because there are no statements than follow the wait.

Link to comment

The motion sensors are Insteon.   I was able to push the options down after putting the MS in communication mode so I fixed that issue.  

 

I switched from Status to Control, programs perform the same which is a completely different topic to the wait issue.

 

 That doesn't make sense to kill the program when the IF conditions are no longer met.   It should be If then or If Else...    Not if Then while if is true.

 

Correct.

 

If you use status then when the MS times out it will send an Off command and ISY will change it's status to Off, stopping Then and running Else. See andyf0's program above.

 

However if you use control each line will only detect the initialion of a signal.

 

You would need

If

....control is switched On

OR

....control is NOT switched off

Then

...turn light on

Else

....turn light off

 

Control.switched are two different signals from the MS and one is not the reciprocal of the other. Their is "no-mans land" between the two events and it just means nothing is changing.

 

Most of us disable the Off command (On Only) in the admin console option for the MS.

 

Then we use programs like this.

 

If

....control MS is switched On

Then

....turn light On

....wait 5 minutes

....turn light off.

Else (not required)

....

 

Now, everytime the MS sees motion it retriggers the wait timer and the light never turns off until you stop moving.

Link to comment

Awesome, great feedback.   I will try the MS in (On Only) command and see if that improves things and simplify the code.   My issue is that I'm not always moving in the garage enough to trigger the MS and the lights go out.   So, I was trying different ways to have triggers established or multiple conditions to exist before the lights went out.   Let me simplify and see what happens.

 

Anyway, the second part of the question I don't think was addressed and I'm curious just for future coding.   Do programs skip the wait command?   As per below, there are no if conditions the Then is called from previous program so nothing should be stopping this program.   As soon as I call this Then statement, the "Motion - Garage Motion Off" program is ran.

 

Then 

Set ' Garage LIghts' On

$Garage_Lights_On = 1

Wait 4 Minutes

Run Program 'Motion - Garage Motion Off' (If)

Link to comment

Awesome, great feedback.   I will try the MS in (On Only) command and see if that improves things and simplify the code.   My issue is that I'm not always moving in the garage enough to trigger the MS and the lights go out.   So, I was trying different ways to have triggers established or multiple conditions to exist before the lights went out.   Let me simplify and see what happens.

 

Anyway, the second part of the question I don't think was addressed and I'm curious just for future coding.   Do programs skip the wait command?   As per below, there are no if conditions the Then is called from previous program so nothing should be stopping this program.   As soon as I call this Then statement, the "Motion - Garage Motion Off" program is ran.

 

Then 

Set ' Garage LIghts' On

$Garage_Lights_On = 1

Wait 4 Minutes

Run Program 'Motion - Garage Motion Off' (If)

I'm betting that this is an oder of operation issue.  Does the IF in Garage motion Off look at the status of the garage lights and the variable?  If so, the change in status of the lights to on may be triggering the Off program and evaluating the variable before this program has set the var to 1.  Try reversing the variable and the lights on command in this program and see what happens.  Not seeing the Garage Off program, I'm just guessing though.

 

I have the very same use case in my garage and basement utility room.  Here was my solution to the problem:

 

1) Relocate the MS to a place where it is most likely to pick up continued motion.  In my utility room, I actually added a second MS.  One that sees me enter the area and a second the watches across the area where I will be when I'm in there.  If EITHER detect motion, the timer is reset.

 

2) Lengthen the Off delay.  I started with a 5 minute delay in the garage and I could easily be out there and not re trigger the MS for a 5 minute period.  Going to a 10 min delay significantly reduced the early off syndrome.

 

3) Sound a warning.  I have my delay set at 9:30 mins, then I beep the switches in the garage or utility room  then delay 30 more seconds before off.  This allows me to move a bit and retrigger (Add a beep ahead of the 9:30 wait so you can tell that you successfully re triggered).

 

4) If you have a dimmer, use a scene with a longer ramp rate.  I set my scene Fast On when triggering so the lights come on instantly and Off when timeout occurs. With a 15-30ish second ramp i'm not just left in the dark and instead have time to move and re trigger.

 

Many of these ideas were taken from other peoples ideas here on these forums.  I hope you find them as useful as I have.

 

Hoping this helps.

 

-Xathros

Link to comment

Archived

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


×
×
  • Create New...