Jump to content

Simple Boolean variable for almost no effort


rxache

Recommended Posts

Unless I have seriously missed something in my understanding of the ISY programming language, it lacks any kind of variable the user can manipulate.

 

If it were possible to check the enabled/disabled status of a program from an IF clause, we would have our much needed variable, since the user can enable or disable a program from a THEN or ELSE clause.

 

I don't think this would be require much effort to implement.

 

Any thoughts?

Link to comment

Programs can be used as variables. They are considered True when the Then is run and False when the Else clause executes.

 

You could have a completely empty program and use Run Then and Run Else to set it's status. Then your other programs can check the condition of your Flag program.

 

Be aware that all programs are false when the ISY is booted so you may want to use programs flagged to Run at Startup to set any Flag programs you have in case of a power outage.

 

Rand

Link to comment

I don't know if this is useful for anyone else, but I use KeypadLinc button status as a variable for some of my programs: On/True/1 versus Off/False/0. This is especially useful if you want to see or alter the value of the variable. To avoid unintended behavior, you may need to make sure that the button is neither a controller of any scene nor a responder for any scene. If you want full manual control over the variable then make sure that the button is configured to toggle between on and off when manually pressed. This is how KPL buttons behave from the factory: no scene membership and pressing the button alternates the state.

 

For example, I use a button near my front door to indicate if my home is in travel mode (LED on) or not (LED off). Any programs that I want to run while I'm away are placed in a folder called "Travel Mode" and the folder has a condition "If Status 'Front C - Travel' is On Then Allow the programs in this folder to run." The folder has essentially become a sub-routine that can only run if the value of my Travel Mode button/variable is On/True. Now I just press the button to turn on the LED and set the variable to true before I head out on a business trip or vacation. This triggers an automated lived-in look and turns required lights on and off for a pet-sitter. When I return home I just press the button again to turn the LED off and go back to normal.

 

You can just as easily skip the folder concept and query the status of this button to determine how things should behave in general programs then change the status with program code, if needed. I hope this helps.

 

-Rob

Dana Point, CA USA

Link to comment

Rob:

 

Be careful with that one. I initially had my house setup that way and found that power outages were unpredictable with the KPL button alone. I have an extra level of insurance that the KPL is linked to an ApplianceLinc. I then set the variable to check status of...

 

If

status KPL A is off,

or

status ApplianceLinc is off

 

then run folder, etc.

 

I find the APL is always in the OFF position after power outages, but I've seen errant turn ons by the KPL button.

 

Only my humble opinion, but a $30 backup is worth it for me.

 

Also have the program set to run at reboot.

 

aLf

Link to comment

aLf-

 

Thanks for the warning and the tip!

 

I assumed that power outages could present a problem and so I tested by air-gapping for 15 minutes and everything retained the state it had before power was removed. I don't know if the behavior I'm seeing is caused by a device or version difference since I'm using a KeypadLinc Relay v.33. I tried the same test with a KeypadLinc Dimmer v.2D and after about a 15 second power cut the dimmer reverted to everything off.

 

I tried a 30-minute test to see if the state is kept on the KPL Relay after a a longer outage and it did. If the relay version reliably keeps the state of all of the buttons then that is potentially useful since it could act as 4-bits (4-buttons) static memory or more if you don't need large on and off buttons.

 

Does anyone have any KPL Relays to test to see if this is just a quirk? Thanks again.

Link to comment

Archived

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


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

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