Jump to content

Program as "flag" or "Variable"


jkraus

Recommended Posts

Posted

I want to write a simple program that uses a program status as a flag or variable i.e. if a light is turned on by a certain controller it will turn on say a dummy program "program A", then in "Program B" there will be a condition depending on Status of "Program A". The isy syntax has the ability to check if a program is "ture" is this exactly the same as a program being "on". So can I merely use "program A" and turn it on and off at will and subsequently be able to check if it is on with the is it"true" query?

 

Thx

 

Joe

Posted

Yep a program is currently the only variable in the ISY at the moment, and you can check that program for status at any time. I use empty programs all the time as flags. In fact if you need to count you can use multi-empty programs as several binary bits. The Wiki has a great example of using programs as variables, one of them I use all the time is this one...

 

SwitchLinc_Emulates_Countdown_Timer

 

This is the way I turn SwitchLincs into SwitchLincs Timers without actually buying the more expensive timered device.

 

Thanks,

Posted

Hi Joe,

 

You would only have to watch for the controller being switched On or Off.

This program will toggle between True and False when the switch is pressed On and Off.

 

If
       Control 'Dining Room' is switched On
   And Control 'Dining Room' is not switched Off

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

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

 

 

I want to write a simple program that uses a program status as a flag or variable i.e. if a light is turned on by a certain controller it will turn on say a dummy program "program A", then in "Program B" there will be a condition depending on Status of "Program A". The isy syntax has the ability to check if a program is "ture" is this exactly the same as a program being "on". So can I merely use "program A" and turn it on and off at will and subsequently be able to check if it is on with the is it"true" query?

 

Thx

 

Joe

Posted

Cool thanks. I was trying to set up a control for my garage light that is both controlled by a KPL and a motion sensor. If the lite is activated by the MS then the MS timeout should be able to turn it off, however if turned on by the KPL I want the MS timeout to do nothing. Very common I would think, and the "flag" concept should work

 

Thx

 

Joe

Posted

If
       Control 'Dining Room' is switched On
   And Control 'Dining Room' is not switched Off

Rand,

 

So doesn't the "is not switched Off" already catch everything? Do you need the "is switched On" in this too?

 

Thanks,

Posted

Mark,

 

The Switched On will cause the program to turn True. If we don't have the not Switched Off the program would remain True.

 

If
       Control 'Dining Room' is switched On
   And Control 'Dining Room' is not switched Off

Rand,

 

So doesn't the "is not switched Off" already catch everything? Do you need the "is switched On" in this too?

 

Thanks,

  • 1 month later...
Posted

finally getting around to trying this and I see you can set a program to be active as a resut ot a device being turned on, but not a scene being turnd on correct? Point being the light I want to control is in a scene. if that scene is on then I do not want the motion sensor to control that light in the scene, but if that scene is off then I want the MS to control the light. To use a progam as a flag I would have to add a program to a scene or make it a condition of a scene but I dont think that can be done

Posted

Hi jkraus,

 

You should only need to check the Status of that light.

 

If
       Control 'Kitchen Motion Sensor' is switched Off
   And Control 'Kitchen Motion Sensor' is not switched On
   And Status  'Family Room / Family Room Lamp' > 34%

Then
       Run Program 'Kitchen Low On' (Then Path)

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


 

And

 

If
       Control 'Kitchen Motion Sensor' is switched Off
   And Control 'Kitchen Motion Sensor' is not switched On
   And Status  'Family Room / Family Room Lamp' < 35%

Then
       Run Program 'Kitchen Low Off' (Then Path)

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


 

Rand

Posted

It depends on the way you use your motion sensor (MS), but if you use it in the standard ISY way, your MS just sends ON commands (no OFFs) and your program turns the light on, waits for a set period of time, and then turns the light off.

 

If this is the case, then checking the status of the light won't work because once the MS turns on the light, subsequent ON commands from the MS won't reset the timer, so you get no "occupancy" function from your MS.

 

What you need to do is "turn on" your flag program (i.e. run the "Then" branch) in reaction to ON commands from the same controllers(s) that activate the scene. One way to do this is write a program 'Scene Activated' with all of the controllers for your scene in the if statement:

 

If
       (
            Control 'Main Floor / Foyer Light' is switched On
        And Control 'Main Floor / Foyer Light' is not switched Off
       )
    Or (
            Control 'Main Floor / Foyer Remote' is switched On
        And Control 'Main Floor / Foyer Remote' is not switched Off
       )

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

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

This program should track the status of the scene controlled by your controllers (e.g. a scene with two controllers 'Foyer Light' and 'Foyer Remote' in this case). Note this only works for ON commands to the scene. FAST ON, FADE UP, and BRIGHT will activate the scene accordingly but not put your flag program in the on state.

 

Your MS can then be tied to a program like this:

 

If
       From    Sunset 
       To      Sunrise (next day)
   And Program 'Scene Activated' is False
   And Control 'Main Floor / Foyer Motion-Sensor' is switched On

Then
       Set 'Main Floor / Foyer Light' On 
       Wait  8 minutes 
       Set 'Main Floor / Foyer Light' Off

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

Good Luck

Guest
This topic is now closed to further replies.

×
×
  • Create New...