Jump to content

Program question when it comes to Wait commands.


toddhutch

Recommended Posts

Question about logic, and seems like a bug.  (I'm wondering if this is an issue with this release, as I had other fan related programs (That I was using earlier this year) that I thought were working before I upgraded to 4.6.2)

 

I have a wait at the beginning of the then because I don't want the house to go dark until enough time has passed for my wife to be in her car and pulling out of the garage.  However because the Elk Zone Violated is only briefly positive, it appears that the then statement starts to run but is stopped.  I changed the the Elk Zone to Physical Status is open, and leave the door open, and the then statement will complete.  If I close the door before the second wait time completes, the remainder of the then status doesn't complete.  It is a work around to put the actions in another program, and have this initial program just kick off the other program?  Is this best practice or work around?

 

 

Wan is gone lights off - [iD 004B][Parent 0022]
 
If
        $Wan_Works_Today is 1
    And From     6:15:00AM
        For      1 hour 
    And Elk Zone 'Garage Home Door' is Violated
 
Then
        Wait  15 seconds
        Set Scene 'Living Room' Off
        Set Scene 'Family Room' Off
        Send X10 'A4/Off (11)'
        Set 'Christmas Tree' Off
        Wait  1 minute and 30 seconds
        Set Scene 'Frontyard' Off
        $Wan_Works_Today  = 0
        Set Elk Output 'Output 103' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
 
 
********  Update   *******
 
The below code is working.  Just confirmed this is working, after I added a wait at the beginning, as a test.  I changed it back, and it is correctly showing Running 'Then' in the Activity column on the program summary page.

Lime Grow Light - [iD 0054][Parent 0021]
 
If
        Time is Sunrise + 30 minutes
 
Then
        Set 'Lime Tree Lights' On
        Wait  12 hours 
        Set 'Lime Tree Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
 
 

Best regards,

Todd

Link to comment

Two programs, with the wait in the second program instead of the first, is the usual solution. That's because if something occurs during the wait that causes the first program to evaluate as false, then the second program won't be affected--it will continue to run.

Link to comment

I would do two programs.

 

If

Time is Sunrise + 30 minutes

Then

Set 'Lime Tree Lights' On

Else

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

 

 

 

If

Time is Sunrise + 12 hours 30 minutes

Then

Set 'Lime Tree Lights' Off

Else

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

Link to comment

Is the goal not to use the wait command in case that the ISY994i reboots?

 

So which way is the best practice?

 

Before the two responses above I set it up this way-

 

Lime Grow Light - [iD 0054][Parent 0021]
 
If
        Time is Sunrise
 
Then
        Run Program 'Lime Grow Light - Trigger' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 
 
 
Lime Grow Light - Trigger - [iD 0065][Parent 0021]
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set 'Lime Tree Lights' On
        Wait  12 hours 
        Set 'Lime Tree Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
 
If what I put is best practice, then I should remove the first program, and put the kickoff in my sunrise program which already turns other items on in the morning.
Link to comment

This seems to be a mind bender, how can you do a 12 hour shut off based on sunrise without using a wait command?

How about this :

 

If

Time is Sunrise + 12 hours 30 minutes

Then

Set 'Lime Tree Lights' Off

Else

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

Link to comment

Just curious, would this not work?

 

If

Time is Sunrise + 30 minutes

For 12 hours

Then

Set 'Lime Tree Lights' On

Else

Set 'Lime Tree Lights' Off

 

Am I missing the meaning or a pitfall of For?

 

I do not know whether it will "work" or not, since I do not know what it is you are trying to accomplish.

 

The program above will simply turn the lights on as sunrise+30 and turn them off 12 hours later.

 

Gary Funk's approach in post 6 would do the same thing, albeit with two programs.  Unlike Gary, I prefer the single-program approach all other things being equal.  

Link to comment

 

Is the goal not to use the wait command in case that the ISY994i reboots?

 

 

There is no problem with using the wait command, so long you understand the consequences.  In some cases, the wait statement can actually be very helpful.  The big thing is understanding that wait (and repeats) can be interrupted when the program triggers.  Obviously, this makes it imperative that one understands WHAT causes a program to trigger and manage this.

Link to comment

Just curious, would this not work?

 

If

Time is Sunrise + 30 minutes

For 12 hours

 

Which ISY version are you using? I don't see For 12 house as a conditional option in v.4+.

Link to comment

On 5.0.11b here. I guess that's why...

I don't use 5.x yet, but usually "For" is used to create a loop, which I assume is why the feature was added, allowing you to do more in one program where version 4.x requires multiple programs.

 

For scheduled events, "From" x "To" y is the standard method to do it in one program.  Post #6 has it in two independent programs.  There is no need to have one program calling another.

 

You only need to separate into nested programs if there are multiple conditions that need to be evaluated independently.  That makes it curious that you went to the effort to put your lime tree schedule in two nested programs but didn't put the "Wan is gone lights off" in nested programs.  As you yourself noted and Gary confirmed in post #2, the zone changing status again breaks the chain and stops the program.  That is the time that you would want to break things up.

 

If you still need help with that one you may need to explain exactly what behavior you are looking for and where else the variable gets manipulated.

Link to comment

You don't need a wait and you don't need two programs

 

And a long wait is more susceptible to a reboot, but reboots of ISY don't happen spontaneously except, as I have learned on DST switch day (and unfortunately not just at 2 am).  I have mine on a ups so the only reboots I get are when I update firmware or on DST day.

If
Time is from Sunrise + 30 minutes
 to Sunrise +12 hours

Then
Set 'Lime Tree Lights' On
Else
Set 'Lime Tree Lights' Off

Link to comment

Just curious, would this not work?

 

If

Time is Sunrise + 30 minutes

For 12 hours

Then

Set 'Lime Tree Lights' On

Else

Set 'Lime Tree Lights' Off

 

Am I missing the meaning or a pitfall of For?

There is no "for" in the if clause on any version of firmware I'm aware of.

 

The only "for" is in the then/else clause as part of a "repeat for x times" first introduced in the 5.x firmware.

Link to comment

Good morning,

 

The Lime Tree is working great, albeit, I've been rebooting the ISY a number of times while working on the Polyglot, so I want to make sure it does get shut off after 12 hours of being on.  That was a test case for the original issue, the wan work item.

 

The problems has been resolved for Wan work.  I've since upgraded to 5.11 since I first posted this, so I need reevaluate with the new options in 5.x.  

Link to comment

This is in 5.0.11b.

 

forscap.jpg

 

My guess is that is not the intended use. It will probably not reevaluate to use the else clause and will mean the program is active for 12 hours rather than active for 2 instants a day, as well as not recover from a reboot.  Does the second pull down have a "To" option?

Link to comment

Archived

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


×
×
  • Create New...