Jump to content

"wait" command


isenbje

Recommended Posts

I have 2 programs that are programed to start executing at the same time. Both contain wait commands. It appears that after one program executes a wait command the second program reevaluates its start time, at which point it stops executing. What to do?

Link to comment

If

Program 'IsShabbatOrYomtov' is True

And (

(

Time is 7:00:00AM

And Program 'is9Minyan' is False

)

Or (

Time is 7:30:00AM

And Program 'is9Minyan' is True

)

)

 

Then

Set 'Dafna's Bathroom' On

Wait 30 minutes

Set 'Curlers' On

Set Scene 'Master Bathroom' On

Set Scene 'Closets' On

Set 'Upstairs Bathroom' On

Set 'Jerry's Bathroom' 50%

Wait 2 hours

Set 'Curlers' Off

Set Scene 'Master Bathroom' Off

Set Scene 'Closets' Off

Set 'Upstairs Bathroom' Off

Set 'Jerry's Bathroom' Off

Set 'Dafna's Bathroom' Off

 

Else

- No Actions - (To add one, press 'Action')

 

 

 

If

Program 'isRaining' is False

And (

On Sat, Tue, Thu

Time is 7:30:00AM

)

 

Then

Set 'Sprinkler / Zone1 Streetside' On

Wait 8 minutes

Set 'Sprinkler / Zone1 Streetside' Off

Set 'Sprinkler / Zone2 Roses along sidewalk' On

Wait 5 minutes

Set 'Sprinkler / Zone2 Roses along sidewalk' Off

Set 'Sprinkler / Zone3 Front edge of house' On

Wait 5 minutes

Set 'Sprinkler / Zone3 Front edge of house' Off

Set 'Sprinkler / Zone4 South edge of house' On

Wait 5 minutes

Set 'Sprinkler / Zone4 South edge of house' Off

Set 'Sprinkler / Zone5 Poolside' On

Wait 5 minutes

Set 'Sprinkler / Zone5 Poolside' Off

 

Else

- No Actions - (To add one, press 'Action')

Link to comment

Without knowing what are the names of these two programs, or knowing what makes programs "IsShabbatOrYomtov", 'is9Minyan', or 'isRaining' to be true or false, it will be hard to say what is causing your programs to halt execution during the wait statement.

 

Assuming the conditions of these two programs accomplish your goals, my temptation would be not to worry about attempting to isolate your problem. Instead, break out the THEN paths of each program, putting them into separate (disabled, without IF conditions) programs. For example, create a program (disabling it) that looks like this:

 

IF
THEN
Set 'Dafna's Bathroom' On
Wait 30 minutes 
Set 'Curlers' On
Set Scene 'Master Bathroom' On
Set Scene 'Closets' On
Set 'Upstairs Bathroom' On
Set 'Jerry's Bathroom' 50%
Wait 2 hours 
Set 'Curlers' Off
Set Scene 'Master Bathroom' Off
Set Scene 'Closets' Off
Set 'Upstairs Bathroom' Off
Set 'Jerry's Bathroom' Off
Set 'Dafna's Bathroom' Off
ELSE

 

Then modify your first program to look like this:

 

If
Program 'IsShabbatOrYomtov' is True
And (
(
Time is 7:00:00AM
And Program 'is9Minyan' is False
)
Or (
Time is 7:30:00AM
And Program 'is9Minyan' is True
)
)

Then
run new program (then path)

Else
- No Actions - (To add one, press 'Action')

 

Take the same approach to the second program.

Link to comment

Thank you for your suggestion.

 

FYI from my log

 

1. Both programs started executing at 7:30 AM Saturday morning

2. The command "Set 'Dafna's Bathroom' On" in the 1st program executed successfully.

3. The second program for the sprinkler system executed completely

4. None of the commands in the 1st program after the command noted above were executed.

 

I can try your suggestion, but can you explain why it could solve the problem?

Link to comment

If nothing executed after the 30 minute Wait either 'IsShabbatOrYomtov' or 'is9Minyan' changed Status before the Wait completed. That change in Status terminated the Wait and executed the Else.

 

Note: it is a good idea to identify the names of Programs that are posted.

Link to comment
I can try your suggestion, but can you explain why it could solve the problem?

 

Like LeeG suggests, I and I concur...I believe something in your program is changing and triggering your program, likely changing status to false during the 30 minute wait. Look at your program list and find the current status of this first program? Is it false? When was it last executed? After 7:30 and before 8:00?

 

The purpose of breaking it out into it's own program is to avoid it being interrupted by a change in status. Once running, unless called manually or by another program, it will continue to the end. No wait statements will be interrupted.

Link to comment

That is what happens according to the log. Program begins execution at 7 AM and then aborts at 7:30. isMinyan is false and IsShabbatOrYomtov is true.

 

I reran it this morning. The isMinyan and IsShabbatOrYomtov parameters had not changed their status. Is it possible that the program aborts because the wait command forces it to recalculate the time and the change from 7 AM to 7:30 AM forces it to stop execution?

 

Sprinkler program ran to completion.

Link to comment

The Program is in the 30 minute Wait at 7:30. The Program is triggered at 7:30 because of the Time parameter. Being ANDed with †'is9Minyan' is True†the evaluation is False so the Else clause executes.

 

Knowing the Program started at 7:00 rather than 7:30 as was originally indicated changes how the scenario occurs but the result is the same. Starting at 7:00 means the 7:30 Time triggers the Program. If it had started at 7:30 one of the other conditions would have had to change to cause the Program to trigger again as the Time parameters had already passed.

Link to comment

Thank you. In order to solve the problem I will break out the program following oberkc's suggestion shown above.

 

I feel this is a bug in the programming. There should be a way to give a wait command that does not allow the status to be reevaluated.

Link to comment

It is not a bug as that is how the Wait and Repeat functions are designed to work. The Wiki section that covers Wait and Repeat explains this interaction. I think adding an option to Wait and Repeat to prevent the If reevaluation has been asked for but has a low priority as using two Programs is the alternative.

 

The If reevaluation works well when used with actions that repeat such as Motion Sensors where the actions after the Wait/Repeat are desired only after all motion stops.

 

If Control 'motion - sensor' is switched On
Then
turn lights On
Wait 10 minutes
turn lights Off
Else

 

The lights stay On as long a motion detection continues.

Link to comment
I feel this is a bug in the programming

 

I have always viewed this as a design decision rather than a bug. It does have its advantages in certain cases, and disadvantages in others. Others, however, have voiced similar viewpoints to your own.

 

There should be a way to give a wait command that does not allow the status to be reevaluated.

 

I believe that there is a way. It is the one I suggested. Alternatively, you can "disable" a program, which restricts a program from self-initiating (allowing the status to be reevaluated).

 

I think you will find sufficient flexibility in programming the ISY, but it does have some learning curve to fully exploit.

Link to comment

The issue with non-interruptable waits/repeats has been beaten to a pulp. Indeed, it would be nice to have it both ways and probably UD will do something that allows you to choose. In the mean time, you accomplish the same thing by splitting the program in 2.

 

 

If

various conditions

Then

wait x time

do something

Else

blank

 

Can be changed to

Program 1

If

various conditions

Then

run program 2, then clause

Else

blank

 

Program 2

If

blank

Then

disable program 1

wait x time

enable program 1

do something

Else

blank

 

 

Now your "wait" clause will run to completion no matter what.

Link to comment

Rather than splitting the program I believe I can achieve the same end result by introducing the program-variable ContinueHolyMorning shown below (in 3 places). When the program below starts executing it is immediately set to true thereby keeping the 'then' part of the if statement true (avoiding early termination due to a change of status) until the very last statement in the program is executed, when it is set to false. This should prevent the program from aborting.

 

Thank you for pointing out that there are many ways to "skin the cat".

 

If

Program 'IsShabbatOrYomtov' is True

And (

(

Time is 7:00:00AM

And Program 'is9Minyan' is False

)

Or (

Time is 7:30:00AM

And Program 'is9Minyan' is True

)

Or Program 'ContinueHolyMorning' is True

)

 

Then

Run Program 'ContinueHolyMorning' (Then Path)

Set 'Dafna's Bathroom' On

Wait 30 minutes

Set 'Curlers' On

Set Scene 'Master Bathroom' On

Set Scene 'Closets' On

Set 'Upstairs Bathroom' On

Set 'Jerry's Bathroom' 50%

Wait 2 hours

Set 'Curlers' Off

Set Scene 'Master Bathroom' Off

Set Scene 'Closets' Off

Set 'Upstairs Bathroom' Off

Set 'Jerry's Bathroom' Off

Set 'Dafna's Bathroom' Off

Run Program 'ContinueHolyMorning' (Else Path)

 

Else

- No Actions - (To add one, press 'Action')

Link to comment

Keeping the program "true" does not stop it from re-evaluating the if and starting the timer over.

 

For example,

 

If

control light x is switched on

Then

wait x minutes

do something

Else

blank

 

This program will restart the wait every time light x on button is pushed, even if it is already on.

 

In short, anything in the "if" clause that experiences a triggerable event, will kill a wait/repeat and either start it over again, or run the other clause. At times, this is a good thing. Like if you have a motion detector and want every re-trigger of it to restart a timer.

Link to comment
Rather than splitting the program I believe I can achieve the same end result by introducing the program-variable ContinueHolyMorning shown below (in 3 places).

 

If you would rather avoid splitting the program for some reason, perhaps you can take advantage of an command to "disable" itself, then enabling itself after it is finished. There are also integer variables available that, when used as conditions in programs, do not act as triggers for the program. This may offer some options.

 

But I second apostolaksl observation that it is not a CHANGE in status that triggers a re-evaluation. All of your program conditions are also program triggers. When triggered and evaluated, even if no change of state takes place, the program will re-execute whatever path is dictated by the evaluation, from the beginning. So, if the program is 29 minutes into the wait period and the program is retriggered and again found true, the THEN condition will rerun, from the beginning.

 

Perhaps, if you care to share your purpose and goals for this program, more specific ideas would come out.

Link to comment

Archived

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


×
×
  • Create New...