Jump to content

Can I decouple Keypad LED state from the the button push?


kclenden

Recommended Posts

Posted

I have an 8-button keypad. I'm using two of the buttons to control the state of the house. Specifically one button allows me to tell the ISY that I'll be away for a while, and the other button allows me to tell the ISY that I have guests. I have a third button that I'm using to "lock" the keypad so that someone doesn't accidentally turn off the "away" and/or "guest" buttons.

 

I have successfully programmed the ISY to ignore pushes of the "away" and "guest" buttons when the "lock" button is ON. My problem is that I haven't been able to get the keypad to ignore pushes of the "away" and "guest" buttons when the "lock" button is ON. By that, I mean that if the "lock" and "away" buttons are ON, and I push the "away" button, the ISY still knows that "away" is active, but the "away" LED on the keypad shuts off.

 

So, is there a way to program the keypad to not change a button's LED state based on the physical pushing of the button so that the LED only changes state based on ISY programs? Or must I create a program that monitors the button push, and sets the LED state according to the state of specific ISY variables (basically turning the LED back ON after the button push has turned it off)?

Posted

"is there a way to program the keypad to not change a button's LED state based on the physical pushing of the button"

 

No.

Posted
"is there a way to program the keypad to not change a button's LED state based on the physical pushing of the button"

 

No.

 

Thanks. So I'll continue to use my solution that simply changes the LED state back to what it should be. This brings up another question...

 

Has anyone else seen strange results when using integer variables as the condition controlling a folder? I have a variable called iAway.From.Home and if I use it as part of a program's IF condition it works correctly. However, if I put that program in a folder, and then I use the iAway.From.Home variable in the IF condition of the folder, I see programs running when they shouldn't.

Posted

If checking the Integer variable is the only thing in the Folder (or Program) If section changing the value of an Integer variable does not cause a Folder or Program to trigger. Has to be a State variable or something else in the IF must be coded to cause the Folder or Program to trigger. Once triggered the Integer variable value can affect the True/False state but does not cause a trigger by itself.

Posted

Thanks Lee - that matches my understanding. What I had setup was a folder that merely used an integer variable to control whether the programs it contained are allowed to run, but not to actually trigger them. The programs themselves are triggered by keypad button CONTROL statements.

 

Here is what I first tried:

 

For simplicity sake, I created one program that uses both the THEN and ELSE segments like:

 

Away Button Synch

If
       (
            Control 'FR-Keypad-Button A / FR-Keypad-Button E' is switched On
         Or Control 'FY-Keypad-Button A / FY-Keypad-Button E' is switched On
         Or Control 'KI-Keypad-Button A / KI-Keypad-Button E' is switched On
       )
   And (
            Control 'FR-Keypad-Button A / FR-Keypad-Button E' is not switched Off
         Or Control 'FY-Keypad-Button A / FY-Keypad-Button E' is not switched Off
         Or Control 'KI-Keypad-Button A / KI-Keypad-Button E' is not switched Off
       )

Then
       Set Scene 'Away Mode' Off

Else
       Set Scene 'Away Mode' On

This program runs when the keypad is locked and an attempt is made to change AWAY status.  If the button LED is
turned off, this will turn it back on, or if it is turned on, this will turn it back off.

 

for the code above to function correctly, it must only run if the keypad is locked, so I added a condition to the folder containing the program like this:

 

Folder Conditions for 'Keypad Button Synch'
Add conditions to limit when programs in this folder are allowed to run.



If
       $iKeypad.Lock is -1

Then
  Allow the programs in this folder to run.


 

For some reason, even when $iKeypad.Lock is not -1, the program within it executes making it impossible to change the status of AWAY.

 

To make it work, I took the condition off the folder, and created two programs:

 

Away Off Button Synch

If
       (
            Control 'FR-Keypad-Button A / FR-Keypad-Button E' is switched On
         Or Control 'FY-Keypad-Button A / FY-Keypad-Button E' is switched On
         Or Control 'KI-Keypad-Button A / KI-Keypad-Button E' is switched On
       )
   And $iKeypad.Lock is -1
   And $iAway.From.Home is 0

Then
       Set Scene 'Away Mode' Off

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

This program runs when the keypad is locked and an attempt is made to turn AWAY on.  The button on the
keypad will light up so it must be turned back off.

 

and

 

Away On Button Synch

If
       (
            Control 'FR-Keypad-Button A / FR-Keypad-Button E' is switched Off
         Or Control 'FY-Keypad-Button A / FY-Keypad-Button E' is switched Off
         Or Control 'KI-Keypad-Button A / KI-Keypad-Button E' is switched Off
       )
   And $iKeypad.Lock is -1
   And $iAway.From.Home is -1

Then
       Set Scene 'Away Mode' On

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

This program runs when the keypad is locked and an attempt is made to turn AWAY off.  The button on the
keypad will shut off so it must be turned back on.

 

I don't understand why my first attempt did not work. How often are the conditions of a folder evaluated to determine whether it's programs should run? Is it every time the conditions of the program itself are evaluated, or at some other interval?

Posted

A Folder has to be triggered to have the If section execute just as a Program does. Using 'If integer variable' does not cause the Folder to be triggered when the Integer variable value is changed. The Folder condition (true or false) does not change when the Integer variable value is changed because changing an Integer variable value does not trigger a Folder or Program.

 

That is what differentiates an Integer variable from a State variable. Changing the value of a State variable will cause a Folder or Program trigger (run) and the If evaluated. Changing the value of an Integer DOES NOT cause a Folder or Program to trigger.

 

There is an entire forum category dedicated to Variables. The first topic describes Variables and explains the only difference between State and Integer Variables is State variable change triggers Folder/Program, Integer does not.

Posted
That is what differentiates an Integer variable from a State variable. Changing the value of a State variable will cause a Folder or Program trigger (run) and the If evaluated. Changing the value of an Integer DOES NOT cause a Folder or Program to trigger.

 

What you say mostly makes sense, except at the boundaries, like device startup. The single program in the folder does execute when the keypad buttons are pressed, even after a reboot of the ISY. So let's step through it:

 

  • [*:1qlysf8t]ISY is rebooted
    [*:1qlysf8t]The INIT values for both $iKeypad.Lock and $iAway.From.Home are 0, so both default to 0.
    [*:1qlysf8t]What is the value of the folder IF condition? Either it defaults to something, or it gets set to something upon first execution.
    [*:1qlysf8t]I press the "AWAY" button on the keypad and the button LED lights up
    [*:1qlysf8t]The SYNCH program runs and turns the LED light off. The program should not have run because $iKeypad.Lock is 0 (not -1). The fact that it ran means either the folder IF condition defaulted to TRUE or it was evaluated to be TRUE (which doesn't make sense) when the program IF condition was evaluated. Since it doesn't make sense for the folder IF condition to evaluate as TRUE, I'm going to assume that the folder condition defaults to TRUE and never actually gets evaluated because the condition does not contain any sort of STATE component.

 

To me, it makes more sense for the condition of a folder to evaluated whenever one its programs is triggered by a state change. The program becomes a STATE trigger for the folder. It doesn't make sense that the folder IF condition would default to anything, TRUE or FALSE, and then just stay that way.

 

I will try adding the keypad button change to the folder IF condition in addition to the check of iKeypad.Lock. If that fixes the issue then I can be pretty certain that the folder IF condition does indeed default to TRUE and never get evaluated.

Posted

"To me, it makes more sense for the condition of a folder to evaluated whenever one its programs is triggered by a state change."

 

That may make more sense to you but that is NOT the way it works. If the Folder condition does not allow Programs to run/trigger (Folder is False) the Programs do no trigger on their own. The Programs do not trigger even if the Program has an 'If State Variable' and the State variable value is changed because a Folder with a False state prevents Programs below it from running. That is one of the functions of a Folder, establish a set of conditions that control whether the underlying Programs can or cannot be triggered.

 

I don't know what happens at reboot with a Folder testing an Integer variable. Since the If condition makes no sense I've not tested what happens with that scenario. It is pretty easy, simply look at the Folder condition after the ISY reboots.

 

EDIT: take a look at this Wiki link. It covers Folder conditions in detail

 

http://wiki.universal-devices.com/index ... tion_Order

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.5k
×
×
  • Create New...