Jump to content

Schedule IF Breaks Program


HokiePerogi

Recommended Posts

Here is my program that isn't working with the Schedule:

 

If

Status 'Rec Room Stairs Top' is Off

And-(

| Control 'Rec Room Theater Front' is switched Off

| Or Control 'Rec Room Theater Front' is switched Fast Off

| Or Control 'Rec Room Theater Front' is switched Fade Down

-)

And From Sunset - 1 hour

For 10 hours

 

Then

Set Scene 'Rec Room Stairs 3-way' Fade Up

 

Else

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

 

 

When I remove the schedule clause, this program works as expected.

 

Any help is appreciated.

 

Thanks!

Link to comment

Hello HokiePerogi,

 

Chris is our expert, and I will defer to him. But from what I can see, your program should work correctly.

 

Would you kindly move the schedule condition to the top of the IF? I really would not expect that to make a difference, but if you have identified a bug, then this might help point it out. Also, please ensure that the Status clause is an And condition and not an Or condition; it will become visible when selected by clicking on it, or when it is not the top clause.

Link to comment

One additional comment,

 

With the V2.6.1 firmware, a fade Up/Down is only registered by the ISY when it is followed by a Fade Stop. Can't comment on the latest beta 2.6.2.

 

In your example, using the Fade up will not register a change in the status of the Scene devices.

 

I'm not sure if that is what you had in mind.

 

IM

Link to comment
Hello HokiePerogi,

 

Chris is our expert, and I will defer to him. But from what I can see, your program should work correctly.

 

Would you kindly move the schedule condition to the top of the IF? I really would not expect that to make a difference, but if you have identified a bug, then this might help point it out. Also, please ensure that the Status clause is an And condition and not an Or condition; it will become visible when selected by clicking on it, or when it is not the top clause.

 

Based on the suggestions from Darrell and IndyMike, I have updated the code to be the below. I also ensured the schedule clause is an 'AND'. I will test it tonight when I get home and the sun sets.

 

Thank you!

 

 

If
       From    Sunset  -  1 hour 
       For      10 hours 
   And Status  'Rec Room Stairs Top' is Off
   And (
            Control 'Rec Room Theater Front' is switched Off
         Or Control 'Rec Room Theater Front' is switched Fast Off
         Or Control 'Rec Room Theater Front' is switched Fade Down
       )

Then
       Set Scene 'Rec Room Stairs 3-way' On

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

Link to comment

Well, I said 1 additional comment - I guess I lied.

 

In your code below I'm assuming the the statement

 

Set Scene 'Rec Room Stairs 3-way' On also activates the condition

And Status 'Rec Room Stairs Top' is Off changing it's status to "not off".

 

If this is true, it's a no-no. When you activate the "scene" it will generate a status event on the "Rec room stairs top" and your condition will evaluate to "false".

 

As written, you do not have any statements past the "set scene". This will most likely work. If you had additional statements, they might not be executed. Try to avoid this in the future.

 

 

 

 

 

 

If
       From    Sunset  -  1 hour 
       For      10 hours 
   And Status  'Rec Room Stairs Top' is Off
   And (
            Control 'Rec Room Theater Front' is switched Off
         Or Control 'Rec Room Theater Front' is switched Fast Off
         Or Control 'Rec Room Theater Front' is switched Fade Down
       )

Then
       Set Scene 'Rec Room Stairs 3-way' On

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

Link to comment
Well, I said 1 additional comment - I guess I lied.

 

In your code below I'm assuming the the statement

 

Set Scene 'Rec Room Stairs 3-way' On also activates the condition

And Status 'Rec Room Stairs Top' is Off changing it's status to "not off".

 

If this is true, it's a no-no. When you activate the "scene" it will generate a status event on the "Rec room stairs top" and your condition will evaluate to "false".

 

As written, you do not have any statements past the "set scene". This will most likely work. If you had additional statements, they might not be executed. Try to avoid this in the future.

 

IndyMike,

 

Can you suggest another way to meet my requirements? I'm stumped as of right now.

 

Can I query the status of the scene in the condition instead of the status of switch?

 

Does that even solve the problem you pointed out?

 

 

Sorry, still trying to come up to speed on writing programs.

Link to comment

HokiePerogi,

 

I'm almost sorry I brought this up. I don't believe it's related to your current problem. It could cause problems down the road.

 

In general you should avoid programming an action that will change your conditions. This will create a new "event" that will be evaluated by your program (i.e. your program is re-started and the conditions re-evaluated).

 

A status request on one of the conditions will (I believe) produce the same re-evaluation.

 

If you are using a "status" condition, and want to modify the status of the same device, you need to use two programs.

 

The following is a modification of your latest code.

If
Status 'Rec Room Stairs Top' is Off
And-(
| Control 'Rec Room Theater Front' is switched Off
| Or Control 'Rec Room Theater Front' is switched Fast Off
| Or Control 'Rec Room Theater Front' is switched Fade Down
-)
And From Sunset - 1 hour
For 10 hours

Then
Set Scene 'Rec Room Stairs 3-way' On
delay 30 seconds
Set Scene 'Rec Room Stairs 3-way' Off

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

1)If the "Set Scene 'Rec Room Stairs 3-way' On" changes the state of your status condition "Status 'Rec Room Stairs Top' is Off" a new event will be triggered and the condition will be re-evaluated.

 

2)If the status condition has changed from "off" the program will evaluate to false, and terminate execution (most likely in the middle of the 30 sec delay).

 

3) Worst case - an event is generated and the status is still true (rec room stairs is off) - you wind up with a looping program (constantly re-triggering). This is my supposition - Chris is the expert.

 

To handle this properly, divide the program up as follows:

 

If
Status 'Rec Room Stairs Top' is Off
And-(
| Control 'Rec Room Theater Front' is switched Off
| Or Control 'Rec Room Theater Front' is switched Fast Off
| Or Control 'Rec Room Theater Front' is switched Fade Down
-)
And From Sunset - 1 hour
For 10 hours

Then
Run program "Theater Room Stairs"
Else
- No Actions - (To add one, press 'Action')

 

Program "Theater Room Stairs"

If
   - no conditions

Then
Set Scene 'Rec Room Stairs 3-way' On
delay 30 seconds
Set Scene 'Rec Room Stairs 3-way' Off

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

 

Again, I don't believe this has anything to do with your current problem. I think your program will work "as is". I'm just trying to prevent any hardship "down the road". I'm speaking as one who has been through the "school of hard knocks". To my mind, the best way of learning is through doing - welcome to the club.

 

IM

Link to comment

Hmmm...well it seems to be working now! I will continue to test and report back if it doesn't respond.

 

Thanks for everyone's help. I think I may have just been working on it too late last night for my own good.

 

Final code is below.

 

 

If
       From    Sunset  -  1 hour 
       To      Sunrise +  1 hour  (next day)
   And Status  'Rec Room Stairs Top' is Off
   And (
            Control 'Rec Room Theater Front' is switched Off
         Or Control 'Rec Room Theater Front' is switched Fast Off
         Or Control 'Rec Room Theater Front' is switched Fade Down
       )

Then
       Set Scene 'Rec Room Stairs 3-way' Fade Up

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

Link to comment

You should always follow a Fade Up/Down with a Fade Stop.

 

If
       From    Sunset  -  1 hour
       To      Sunrise +  1 hour  (next day)
   And Status  'Rec Room Stairs Top' is Off
   And (
            Control 'Rec Room Theater Front' is switched Off
         Or Control 'Rec Room Theater Front' is switched Fast Off
         Or Control 'Rec Room Theater Front' is switched Fade Down
       )

Then
       Set Scene 'Rec Room Stairs 3-way' Fade Up
       Wait 5 seconds
       Set Scene 'Rec Room Stairs 3-way' Fade Stop
Else
  - No Actions - (To add one, press 'Action') 

 

Rand

Link to comment

Ok...so I'm thinking there is still a bug somewhere. The bug seems to present itself after midnight. Using the code given in my last post, the program seems to work after sunset, but only until midnight. After 12:00am, the

 

From Sunset - 1 hour

To Sunrise + 1 hour (next day)

 

part of the code prevents the Then statements from ever executing.

 

I have run into the same issue with the following program:

 

If
       From    11:00:01PM
       To      Sunset  + 59 minutes and 59 seconds (next day)
   And Status  'Front Outside Lights' is not Off

Then
       Wait  10 minutes 
       Set Scene 'Outside Front 3-way' Off

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

 

If I remove the time constraint it behaves as expected now at 1 AM.

If I use a more detailed time constraint, such as FROM 12:00:00AM FOR 3 hours, the program will also work correctly.

 

According to my admin console, my ISY time is corrent, and my Sunrise and Sunset values appear correct for my location (Washington, DC).

 

I believe there is a bug in the logic when using Sunrise/Sunset and next day combination. Remember, these programs work fine, up until midnight.

Link to comment

HokiePerogi,

 

Thanks so much for the update and the added information. This has been mentioned before, and I'll turn this over to Chris, who is the programming expert.

 

In the mean time, the fifth post in this thread contains a workaround, thanks to lutusp: you can break the schedule condition into before/after midnight parts.

 

Please let me know if this works for you.

 

Thanks so much,

Darrell

Link to comment

Thanks Darrell. This is exactly how I went about correcting the issue for the time being. I remember reading the thread you sent be a week ago. I just wanted to make sure the bug was confirmed and tracked.

 

 

Thanks again!

Link to comment

Ok...so I'm thinking there is still a bug somewhere. The bug seems to present itself after midnight. Using the code given in my last post, the program seems to work after sunset, but only until midnight. After 12:00am, the

 

From Sunset - 1 hour

To Sunrise + 1 hour (next day)

 

part of the code prevents the Then statements from ever executing.

Here is the program in question:

If 
       From    Sunset  -  1 hour 
       To      Sunrise +  1 hour  (next day) 
   And Status  'Rec Room Stairs Top' is Off 
   And ( 
            Control 'Rec Room Theater Front' is switched Off 
         Or Control 'Rec Room Theater Front' is switched Fast Off 
         Or Control 'Rec Room Theater Front' is switched Fade Down 
       ) 

Then 
       Set Scene 'Rec Room Stairs 3-way' Fade Up 
       Wait 5 seconds 
       Set Scene 'Rec Room Stairs 3-way' Fade Stop 
Else 
  - No Actions - (To add one, press 'Action') 

 

I've tested the sunset/sunrise (next day) and have found no problems apart from the following one (which was pointed out to me by a few people on the forum).

 

When you save the program, the initial setting for the schedule is based on the current day. This is a problem on the first day only, and only if the start time of a schedule is the previous day (or earlier) and the end time is the current day (or later).

 

For example, If you save the program on Thursday 11:30PM, the initial schedule will be:

sunset - 1 hour on Thursday to sunrise + 1 hour on Friday

 

but if, for example, you save the program on Friday 12:05AM (i.e. 35 minutes later), the initial schedule will be:

sunset - 1 hour on Friday to sunrise + 1 hour on Saturday

 

Therefore in the second example, the schedule doesn't kick-in until Friday evening.

 

We may be able to fix this bug in this release, but no guarantees. Please let me know if you are experiencing a bug other than what I have described here.

Link to comment

Would you kindly move the schedule condition to the top of the IF? I really would not expect that to make a difference, but if you have identified a bug, then this might help point it out.

You are correct, it does not make a difference.

 

Just so there is no confusion, moving the schedule condition to the top of the IF is not required. In general, schedule entries can be placed anywhere just like any other condition in the IF, including within parentheses.

Link to comment

Would you kindly move the schedule condition to the top of the IF? I really would not expect that to make a difference, but if you have identified a bug, then this might help point it out.

You are correct, it does not make a difference.

 

Just so there is no confusion, moving the schedule condition to the top of the IF is not required. In general, schedule entries can be placed anywhere just like any other condition in the IF, including within parentheses.

 

Chris, thanks so much for the clarification. I did not expect that it would (or should) make a difference, unless there were a bug involved. I am happy that that is not the case!

Link to comment
  • 1 month later...

This following problem has been fixed in release 2.6.5

 

 

Ok...so I'm thinking there is still a bug somewhere. The bug seems to present itself after midnight. Using the code given in my last post, the program seems to work after sunset, but only until midnight. After 12:00am, the

 

From Sunset - 1 hour

To Sunrise + 1 hour (next day)

 

part of the code prevents the Then statements from ever executing.

Here is the program in question:

If 
       From    Sunset  -  1 hour 
       To      Sunrise +  1 hour  (next day) 
   And Status  'Rec Room Stairs Top' is Off 
   And ( 
            Control 'Rec Room Theater Front' is switched Off 
         Or Control 'Rec Room Theater Front' is switched Fast Off 
         Or Control 'Rec Room Theater Front' is switched Fade Down 
       ) 

Then 
       Set Scene 'Rec Room Stairs 3-way' Fade Up 
       Wait 5 seconds 
       Set Scene 'Rec Room Stairs 3-way' Fade Stop 
Else 
  - No Actions - (To add one, press 'Action') 

 

I've tested the sunset/sunrise (next day) and have found no problems apart from the following one (which was pointed out to me by a few people on the forum).

 

When you save the program, the initial setting for the schedule is based on the current day. This is a problem on the first day only, and only if the start time of a schedule is the previous day (or earlier) and the end time is the current day (or later).

 

For example, If you save the program on Thursday 11:30PM, the initial schedule will be:

sunset - 1 hour on Thursday to sunrise + 1 hour on Friday

 

but if, for example, you save the program on Friday 12:05AM (i.e. 35 minutes later), the initial schedule will be:

sunset - 1 hour on Friday to sunrise + 1 hour on Saturday

 

Therefore in the second example, the schedule doesn't kick-in until Friday evening.

 

We may be able to fix this bug in this release, but no guarantees. Please let me know if you are experiencing a bug other than what I have described here.

Link to comment

If an undefined From or To were assumed to be midnight that would solve the problem i.e.:

 

IF Time is From Sunset +10

OR Time is To Sunrise -10

THEN... whatever

 

The above would be True from Sunset +10 TO midnight AND From Midnight To Sunrise -10 regardless of what day it is or when the program started. The key here is to use the OR statement rather than the AND statement which could never be true. The AND statement would still be used to define a time bracket other than midnight occurring on the same day.

Link to comment

Archived

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


  • Recently Browsing

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

  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...