Jump to content

Program question when it comes to Wait commands.


toddhutch

Recommended Posts

Posted (edited)

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

Edited by toddhutch
Posted (edited)

When the status changes, the Elk Zone program IF is no longer true and therefore the THEN stops executing.

Edited by Gary Funk
Posted

So this is expected, and when you put in a time condition like 3 minutes after sunrise that behaves differently?

No. That will turn on. However I would not rely on wait. I'd either use two programs or use FROM and TO for the time.
Posted

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.

  • Like 1
Posted (edited)

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')

Edited by Gary Funk
Posted (edited)

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.
Edited by toddhutch
Posted

There is no best practice. Everyone does what works for them.

 

Personally, I avoid long wait periods for various reasons; one being the possibility of a reboot.

Posted

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')

Posted

Doh..... I shouldn't multitask, you posted that earlier. I'll start using that instead of wait.

 

Thank you!

That is just one of the methods to use and my personal choice. With ISY there are always several ways to accomplish a goal.
Posted

Sometimes a wait is necessary, sometimes it's more a convenience. In any case, the goal is to not let the wait cause an unexpected result.

Posted

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?

Posted (edited)

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.  

Edited by oberkc
Posted (edited)

 

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.

Edited by oberkc
Posted

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+.

Posted

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

 

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

Posted

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

I wasn't expecting the 12 house option until 6.x.
Posted

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.

Posted (edited)

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

Edited by apostolakisl
Posted

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.

Posted

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.  

Posted

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.

 

This is in 5.0.11b.

 

forscap.jpg

Posted

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?

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...