Jump to content

Can a KPL lamp be controlled separately from its button


jim_

Recommended Posts

Can a KPL lamp be controlled separately from its button  ?

Trying to flash a KPL lamp  to indicate lights have been left on after a long period of time ... 

I've had the program below for years and works fine, but noted that sometimes in the winter when the most of the lamps are lit on the KPL, we miss the fact the monitor lamp is on

Thought maybe flashing the lamp slowly would draw attention 

I tried this and realized that when setting the KPL "off" in the first blink sequence, it triggers the second program "KPL 8 H All Off " to run  ... 

Hence my question, can the lamp associated with a specific button be controlled separately from the actual button function (I assuming no) 

-------------------------------------------------
KPL 8 H Monitor All 

If
        Basement Light 1 Status >= 1%
     Or Basement Stair 2 Status is On
     Or Basement Stair 3 Status is On

Then
        Set 'KPL 8 - H Basement Lights' On
                                                                                      ---new code
        Wait  XX minutes 
        Repeat 25 times
           Set 'KPL 8 - H Basement Lights' Off
           Wait  5 seconds
           Set 'KPL 8 - H Basement Lights' On
           Wait  5 seconds
                                                                                     ---new code
Else
        Set 'KPL 8 - H Basement Lights' Off
-------------------------------------------------
KPL 8 H All Off 

If
        'KPL 8 H' Status is Off
 
Then
        Set Basement Light 1 Off
        Set Basement Stair 2 Off
        Set Basement Stair 3 Off
-------------------------------------------------

 

Link to comment
15 hours ago, jim_ said:

Can a KPL lamp be controlled separately from its button  ?

The answer is yes, and ironically that is what both of your programs are doing.  In the first program you flash a KPL button LED by turning a scene on and off.  In the second, you check the status of a KPL button LED to decide whether you should turn off the basement lights.  Neither of the programs actually look at the action of the KPL button.  To do that, you use CONTROL instead of STATUS.

CONTROL is a one-time event.  The device sends a command, usually either ON or OFF.  It is an event that signals that something happened locally at the device (e.g. somone pressing a button or the device sending a hearbeat).  When you remotely control the device it does not send out CONTROL commands.  STATUS is a state not an event.  The device remains in that state until changed to another state either by something that happens locally at the device or a remote command.  When you check the STATUS of a device within a program, it only triggers your program to run whenever the state of the device changes to the state you specify.  So for example, your second program only runs when KPL 8 H changes from ON to OFF.  When that happens, you don't know if it was because someone pressed the button, or whether the state was changed remotely, for example by your first program.  What's important is that It doesn't keep triggering your program all the time the status remains OFF.

If I understand what you're trying to accomplish, I would change the IF in your second program to

    'KPL 8 H' is swtiched On
 Or 'KPL 8 H' is swtiched Off

and then add the following to the end of the THEN

Set 'KPL 8 - H Basement Lights' Off

The reason to check for both switched On and switched Off is because your first program changes the state of the KPL 8 - H button LED and while that doesn't send out any commands it does change what command the KPL 8 - H button will send when you press it.  If you press it when it is illuminated, it will send an OFF command, and if you press it when it's not illuminated it will send an ON.  Since you can't know at what point during the blinking the button will be pressed, you need to check for both.  Likewise, since you can't know whether the button is going to be pressed when it's illuminated or not illuminated, in the THEN you need to go ahead and turn the button's LED off just in case it was pressed when it wasn't illuminated (and thus the actual pressing of the button causes the LED to illuminate).

 

Link to comment

Thank You so much kclenden, really good explanation and solution  

Since I had spare switches on hand, I practised on with these rather than the the real thing for now. For anyone wishing to add the same function, this would be the coding that worked for me.   

NOTE :  Suggest keeping the blink slow to reduce the message broadcasts 

KPL Button A - Monitor & Blink 
-------------------------------------
If
        'Test Switch 1' Status >= 1%
     Or 'Test Switch 2' Status >= 1%
 
Then
        Set 'Test KPL A' On
        Wait  10 minutes
        Repeat 200 times
           Set 'Test KPL A' Off
           Wait  5 seconds
           Set 'Test KPL A' On
           Wait  5 seconds
 
Else
        Set 'Test KPL A' Off

============================================

KPL A All Off 
--------------------------------------------
If
        'Test KPL .1 / .A' is switched On    (CONTROL)
     Or 'Test KPL .1 / .A' is switched Off   (CONTROL)
 
Then
        Set 'Test Switch 1' Off
        Set 'Test Switch 2' Off
        Set 'Test KPL A' Off

Link to comment

Archived

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


×
×
  • Create New...