Jump to content

Simple On, Wait and Off Program runs inconsistently


grtaylor

Recommended Posts

Posted

I have a very simple program set to run when a scene elsewhere is switched off, but it doesn't run as I would expect and I cannot figure out why. It's simply this;

If

Switch x is turned off

Then

Set 'Master Suite Bedside Lamp' On

wait 2 minutes

Set 'Master Suite Bedside Lamp' Off

 

So if I try to run the 'Then' from the console when the Status is False, it switches the lamp on, then exits. If I then re-run the Then (light is now on), status is still False, andvthe program runs, does the wait and then turns it off.

 

Am I doing something dumb? Why it need to run twice to work? Why does it not do the Wait first time round?

Posted

The actual If statement would be better posted rather than pseudo code. From the results discussed it sounds like "If Status 'xxxxx' is Off" is being used where the Then clause if changing the state of 'xxxxx'. When the Wait is executed any change in state of 'xxxxx' causes the If to be reevaluated and probably ran the Else clause. Next time the Status is already On so the initial statement does not change the Status so the Wait completes and executes the Off.

 

The effect of changing the conditions the If clause is testing has on Wait and Repeat is covered pretty well in the Wiki.

 

If you right click the Program name, there is an option 'Copy to Clipboard' which copies the Program to the OS Clipboard. At that point a Paste can be done into a forum post to get the actual program logic in the post.

Posted

Thanks Lee, here it is

 

If

From 5:00:00PM

To 2:51:00AM (next day)

And Control 'Front Dr 8 Way Sw C - Evening' is switched Off

And Status 'Master Side Lamp' is not On

 

Then

Set 'Master Side Lamp' On

Wait 2 minutes

Set 'Master Side Lamp' Off

 

Else

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

Posted

That is the problem. The Program is changing the state of 'Master Side Lamp' in the Then clause as well as well as testing 'Master Side Lamp' Status in the If. When the Wait is executed the If is reevaluated because one of the conditions it is testing has changed. Because 'Master Side Lamp' is not On the If is False and the Else executes.

 

The next time the Then clause is run 'Master Side Lamp' starts off being On so what the Then clause issued the Set On the Status does not change so the Wait completes as expected. The solution is to put the Then logic into a second Program that is invoked from the Then clause of the current Program. The second Program has nothing in the If clause so changing the Status of 'Master Side Lamp' does not affect the Wait.

Posted

Correct. There is a Run at Startup option that can trigger the Program when the ISY boots but a Program with an empty If clause has to be 'Run' from another Program

Guest
This topic is now closed to further replies.

×
×
  • Create New...