Jump to content

Two step bedroom lamp OFF - Wait doesn't wait.


dpayeur

Recommended Posts

Posted

Hello all (first post here),

 

I have a new ISY-99i (2.7) and I love it! After fighting with mControl, HouseLinc and some home made solutions using SDM, the ISY works like a charm and does what you expect it would. Thank you UD.

 

Now for a small problem ...

 

I want my bedroom table lamp to turn off in two steps, to allow me to put my book down before it goes full off. Something like this:

 

if(lamp is ON)
{
  set lamp = 50%
  wait 10 seconds
  if(lamp is 50%)
  {
     set lamp = OFF
  }
}

 

I add the first 'if' to make sure that if the lamp is already OFF it doesn't go to 50% for a few seconds and then back OFF. And the second 'if' to allow me to 'override' by turning it back ON during the wait to read a bit longer.

 

To do that with the ISY, I made two programs:

 

"Bedroom OFF" A like this(approx):

          If Time Is 10:15:00pm
   And Status 'Lamp' is ON
Then
          Set 'lamp' 50%
          Wait 10 seconds
          Run Program 'Bedroom B' (Then Path)
Else
  - No Actions

 

And "Bedroom B" like this (approx):

 

         If Status 'Lamp' is 50%
Then
          Set 'lamp' Off
Else
  - No Actions

 

The problem is the 'Wait' command does not seem to work. It does wait because the status of program A says it's running for a little while but it goes right on and run program B, while waiting.

 

I found some references to that in the forums but no solutions.

 

Is there a (better) way to accomplish this simple need ?

 

thank

you

 

 

Donald

Posted

Hi and welcome

 

I cobbled together a pair of sample program that uses one switch to control the kind of scene change you want. "U/S Office Cans" is the light being controlled and "U/S Hall Aux." is the controller for the program. Just what was handy - translate for your own needs

 

If

Status 'U/S Office Cans' > 49%

And Control 'U/S Hall Aux.' is switched On

 

Then

Run Program 'Program2' (Then Path)

 

Else

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

 

If

- No Conditions - (To add one, press 'Schedule' or 'Condition')

 

Then

Set 'U/S Office Cans' 50%

Wait 10 seconds

Set 'U/S Office Cans' Off

 

Else

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

 

 

You need two programs, though not I believe for the reason you think. If you collapse Program2's logic into Program1's Then part, you end up canceling your own program after the initial change down to 50% (though I'll confess I'm hard-pressed to explain exactly why that happens.) Granularizing all the logic in another program prevents that.

 

I believe there is also a restriction that a tail Wait in an ISY clause does nothing, though again I could be fuzzy on this; I don't try to use that sort of thing much.

 

Programmers look at the ISY languange and see programming constructs, but it is really a very nice, simple, real-time, largely stateless, instantiated, applicative language. Don't try to force too much out of one program and it gets easier. While sometimes useful, if you start looking for ways to emulate nested ifs, variables, etc. it gets ugly very fast.

 

HTH

Posted

ergodic, thanks for your reply.

 

But what happens if the light goes to 50% and I bring it back up to ON during the 10 secs wait. It'll force it to OFF after the wait.

 

I really need the program to check that the lamp is still at 50% before it turns it OFF...

 

 

thanks

Donald

Posted

The simplest is to just create another program that watches for the control/status change you are interested in, and executes a Stop Program on when it sees that happen. If isn't running it won't hurt anything.

Posted

Hello Donald,

 

In your first program, when the lamp is set to 50%, the Status 'Lamp' is On condition becomes false (On = 100%), and therefore as soon as the Wait line is reached, the If is re-evaluated and the program switches from running the Then to running the Else. To overcome this, change that line to Status 'Lamp' is Not Off.

 

Also, in order to have program B's If evaluated when called from program A, change the line in program A's Then to run program B's If rather than its Then.

 

Finally, the reason program B runs immediately is because as soon as the lamp is set to 50%, program B's If becomes true. To prevent program B from running automatically, clear its Enabled checkbox. Program B will then only run when called from another program.

 

"Bedroom OFF" A:

If Time Is 10:15:00pm
   And Status 'Lamp' is Not Off
Then
   Set 'lamp' 50%
   Wait 10 seconds
   Run Program 'Bedroom B' (If)
Else
  - No Actions

 

"Bedroom B": (NOT Enabled)

If Status 'Lamp' is 50%
Then
   Set 'lamp' Off
Else
  - No Actions

Posted

Thanks for the replies.

 

I got it working now.

 

I was stomped by the program's ability to quit if its conditions turn false during the execution ... I guess I had too much of a 'procedural' programming minding.

 

Thanks to all

 

Donald

Guest
This topic is now closed to further replies.

×
×
  • Create New...