Jump to content

Run Else, but only if program is True


Steven
Go to solution Solved by Techman,

Recommended Posts

Here's my case:

I have a security system that can be "armed away", "armed stay", or "disarmed". When it changes into one of those states it can trigger a script, that can call an ISY program via the REST URL.

I have a program named "armed away" and another named "armed stay". They do different things.  (E.g. the "armed away" program turns a radio on and off. The "armed stay" program turns the living room lights off.

The issue is that the security system sends a "disarmed" event, but doesn't distinguish how it was previously armed. That can call the Else Path for one of the programs, or can call a separate "disarm" program. I would like this event to call the Else Path for whichever of the programs that is currently true. Is there a way to say: "Call the Else Path for the "armed away" program, but don't call it if it was already false?

Link to comment
  • Solution

Why not have a program set variables, one for armed stay and one for armed away.

A program could look at the variables to determine the state of the system, and then reset the variable when the system is disarmed.

Link to comment

That solved the problem. The security system runs the "disarmed" (Then Path) when it's disarmed.

There is program named "disarmed stay" that has an If condition of Program:disarmed is True AND $Alarm_state is 1.

Another program named "disarmed away" has an If condition of Program:disarmed is True AND $Alarm_state is 2.

The "Then" of "disarmed stay", runs the Else Path of "armed stay".

The "Then" of "armed stay" sets $Alarm_state to 1.

The "Then" of "disarmed" sets $Alarm_state to 0.

The only thing that could be cleaner is the system could be armed "stay", then armed "away" without an intervening "disarm". To handle this, the "armed away" Then calls the "armed stay" (Else Path). That may cause some extra events, but it doesn't seem to hurt.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...