Jump to content

What am I missing on using "Control" in program?


jmesberg

Recommended Posts

Posted

I'm fairly new at this but so far all of my programs have been working as I expected and I've found the ISY programming model to be very easy to understand and use. So, here is my first failure: I'm using a KPL button to "arm" an alarm, i.e. basically just switching a variable from 0 to 1 to indicate "Armed".

 

Here it is:

 

If

Control 'Keypads / KPL2-Arm Alarm' is switched On

 

Then

$AlarmArmed = 1

 

Else

$AlarmArmed = 0

 

Since I used Control vs Status I assumed that anytime the KPL button is "On" then the variable $AlarmArmed would be 1, and vice versa. Here is what actually happens: With Variable manually set to 0 I push KPL button => variable is now set to 1. All good. Now I push KPL button "Off" and while I'd expect Variable to then set back to 0 it does not....stays at 1.

 

Huh? Should I go back to using Status? If so, please explain why.

 

John

Posted

No. If Control command must match the inbound command to trigger the Program. Without an If Control Off the Program is not triggered. To get the Else clause to run the If must evaluate to False. To achieve both conditions, match the command and be False add a not.

 

If Control 'xxxx' is switched On

or Control 'xxxx' is not switched Off

Then

runs when On is received

Else

runs when Off is received.

 

Controls works a little differently than Status. Any Status change triggers the Program. Control must match the command for the Program to be triggered.

Posted

Worked perfectly. I think I can get my head around this logic, but frankly it might be better if ISY just 'assumed' that if Control <> ON then evaluate program checking to see if Control = ON to False. What would be the downside of UDI making this change? (I'm sure there is a downside....and by learning it I'll better understand the system).

 

John

Posted
Worked perfectly. I think I can get my head around this logic, but frankly it might be better if ISY just 'assumed' that if Control <> ON then evaluate program checking to see if Control = ON to False. What would be the downside of UDI making this change? (I'm sure there is a downside....and by learning it I'll better understand the system).

 

John

 

That is what "status" is for.

 

Control means that you physically went to he device and "controlled" it by pushing the button. "control on" triggers itself only when an "on" command is received from that device. If something else triggers the program, it is false, since no one pushed the "on" button at the exact same point in time.

 

Everyting I said is backwards if you use "control is not". It just swaps the true/false outcome of the event, but otherwise it is the same.

Posted

Hi John,

 

Control is unlike status and it requires a lot of care to be used in conditional/event based logic. What you suggest will also include DIM/BRT/FAST ON/OFF and all other controls and that's not what the intent of your program is.

 

With kind regards,

Michel

Posted

The purpose of "control" is to ask the question:

 

"Did someone push the button?"

 

The purpose of "status" is to ask the question:

 

"At present, what state is the light in?"

 

 

So these are very different things which serve different purposes.

 

The below program asks the question, "when I open the front door, and it is dark outside, are the outside lights already on?" If not, it runs a separate program which turns them on for a specific period of time. I have done it this way so that if the light were already on, then the lights would be left alone (no off timer gets started).

 

If
       Program 'Dark Outside' is True
   And Elk Zone 'Front Door' is Violated
   And Status  'Foyer / Foyer-Coach L' is Off
   And Status  'Foyer / Foyer-Portico Can L' is Off

Then
       Run Program 'front door 2' (Else Path)

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


 

The below program asks the question, "is the light already off when someone pushes the off button?". If so, it turns the light on to a low setting. This is a function I use as a night light. When you wake up to go to the bathroom, you can easily bring the lights up just bright enough to see without overly waking you.

 

If
       Status  'Alexis Room / Alex Bath-Mirror L' is Off
   And Control 'Alexis Room / Alex Bath-Mirror L' is switched Off

Then
       Set 'Alexis Room / Alex Bath-Mirror L' 25%

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


Guest
This topic is now closed to further replies.

×
×
  • Create New...