How to control keypadlink buttons from python?

Posted on
Sat Feb 23, 2019 9:28 pm
peszko offline
Posts: 311
Joined: Mar 07, 2012

How to control keypadlink buttons from python?

I know that I can read a keypadlink button state using :

Code: Select all
indigo.devices["myKeypadlink"].states["keypadButtonLed1"]


I tried to use:

Code: Select all
 indigo.devices["myKeypadlink"].updateStateOnServer(key='keypadButtonLed3', value='True')


But the button doesn't actually light up. The value is changed if I query it again, but it's not affecting the button.
How do I actually controll the button light?

Posted on
Sat Feb 23, 2019 9:44 pm
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: How to control keypadlink buttons from python?

Ok, I think I found it.

Code: Select all
indigo.dimmer.setLedState("MyKeypad", index=3, value=True)


But it doesn't seem to update the states on server. So I'm not sure how I'm supposed to reliably check if the led is on or off.

Posted on
Sat Feb 23, 2019 9:58 pm
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: How to control keypadlink buttons from python?

Ok. Again, I think I know why. The keypadButtonLed4 refers to button index 3 (zero based) so:
Code: Select all
indigo.devices["myKeypadlink"].states["keypadButtonLed4"]

refers to :
Code: Select all
indigo.dimmer.setLedState("myKeypadlink", index=3, value=True)

Posted on
Sun Feb 24, 2019 7:20 am
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: How to control keypadlink buttons from python?

I guess my problem is more with Insteon it self. It looks like I'm getting frequent errors when I set the LEDs on the keypadlinc:

Code: Select all
Error                           "FY_ENT_KPD_LT" keypad button 4 off; send failed (no acknowledgment)


This is a brand new, latest firmware I2cs module that I just bought to replace the I2 one. I just needed the buttons. All others I'm replacing with z-wave. I must have some source of noise on the lines that I haven't yet identified. I have quite a few filters installed.

Posted on
Mon Feb 25, 2019 7:57 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: How to control keypadlink buttons from python?

The commands to set the LED states are Extended Insteon commands which are more susceptible to noise. Alternatively, you can create PowerLinc Groups/Scenes for each button you want to control, then just execute that scene. That will use scene/broadcast commands which are much shorter/faster which will hopefully work in this case.

Image

Posted on
Tue Feb 26, 2019 11:08 am
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: How to control keypadlink buttons from python?

Good to know. I will switch to u sing scenes through action groups.

Posted on
Tue Feb 26, 2019 3:59 pm
CraigM offline
Posts: 587
Joined: Oct 28, 2007

Re: How to control keypadlink buttons from python?

matt (support) wrote:
The commands to set the LED states are Extended Insteon commands which are more susceptible to noise. Alternatively, you can create PowerLinc Groups/Scenes for each button you want to control, then just execute that scene. That will use scene/broadcast commands which are much shorter/faster which will hopefully work in this case.

First thing I do when I get a new KPL is create 8 PowerLinc Links, one for each LED
KPL LED.png
KPL LED.png (57.24 KiB) Viewed 4085 times

Posted on
Tue Feb 26, 2019 7:01 pm
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: How to control keypadlink buttons from python?

So here is what I'v done, and it seems to be more reliable and a lot faster to respond. This code is executed on any clock light state change (on trigger for each device assigned to a button). The if statement is to prevent sending commands on actual button press.

Code: Select all
FY_ENT_KPD_LT = indigo.devices[1992477190] # "FY_ENT_KPD_LT"
L2_LR_Clock_LT = indigo.devices[67651332] # "L2_LR_Clock_LT"
btn2 = indigo.devices[1992477190].states["keypadButtonLed2"] # clock light

#Clock Light
indigo.server.log("Button 2 state: {}, L2_LR_Clock_LT.onState: {}".format(btn2, L2_LR_Clock_LT.onState))

if L2_LR_Clock_LT.onState == True and btn2 == False:
   indigo.insteon.sendSceneOn(54, sendCleanUps=False)
   indigo.server.log("FY_ENT_KPD_LT - Turning Button 2 ON to match L2_LR_Clock_LT")
elif L2_LR_Clock_LT.onState == False and btn2 == True:
   indigo.insteon.sendSceneOff(54, sendCleanUps=False)
   indigo.server.log("FY_ENT_KPD_LT - Turning Button 2 Off to match L2_LR_Clock_LT")

Posted on
Wed Jun 24, 2020 7:14 am
jenkins007 offline
Posts: 113
Joined: Nov 08, 2006
Location: Seguin, TX

Re: How to control keypadlink buttons from python?

I am running indigo 7.4.1 and really liking this way to sync keypad buttons as I get lots of errors with my 3 KPL's that control lights, Hue lights, and Chicken Coop door controller. I created a scene for each button on the 3 KPL's and verified them through the powerlinc links interface. However when I tried to execute the scenes in the triggers I got the error below. I am very excited to get the buttons in sync. What am I doing wrong?
Here is the error and a screen shot of the code:
Script Error embedded script: 'DimmerDevice' object has no attribute 'onOffState'
Script Error Exception Traceback (most recent call shown last):
embedded script, line 1, at top level
AttributeError: 'DimmerDevice' object has no attribute 'onOffState'
Script Error embedded script: Python argument types in
InsteonCmdInterface.sendSceneOn(InsteonCmdInterface, int)
did not match C++ signature:
sendSceneOn(_InstnCmdInterface {lvalue}, boost::python::api::object scene, bool sendCleanUps=True, bool suppressLogging=False, bool updateStatesOnly=False)
Script Error Exception Traceback (most recent call shown last):
embedded script, line 7, at top level
ArgumentError: Python argument types in
InsteonCmdInterface.sendSceneOn(InsteonCmdInterface, int)
did not match C++ signature:
sendSceneOn(_InstnCmdInterface {lvalue}, boost::python::api::object scene, bool sendCleanUps=True, bool suppressLogging=False, bool updateStatesOnly=False)[
Attachments
Screen Shot 2020-06-24 at 7.58.36 AM.png
Screen Shot 2020-06-24 at 7.58.36 AM.png (126.57 KiB) Viewed 3719 times

Thanks,
Matthew

Posted on
Wed Jun 24, 2020 9:28 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to control keypadlink buttons from python?

Error snip:

jenkins007 wrote:
sendSceneOn(_InstnCmdInterface {lvalue}, boost::python::api::object scene, bool sendCleanUps=True, bool suppressLogging=False, bool updateStatesOnly=False)


Your code:

Code: Select all
indigo.insteon.sendSceneOn(13, sendCleanups = False)


It's sendCleanUps, not sendCleanups. ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jun 25, 2020 3:38 am
jenkins007 offline
Posts: 113
Joined: Nov 08, 2006
Location: Seguin, TX

Re: How to control keypadlink buttons from python?

Thank you Jay... I have 3 KPL's so many triggers, but easy to fix.

Thanks,
Matthew

Posted on
Thu Jun 25, 2020 8:44 am
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: How to control keypadlink buttons from python?

jenkins007 wrote:
Thank you Jay... I have 3 KPL's so many triggers, but easy to fix.



I used to have 12 8 button KPLs in the past and found that the to have all the buttons synchronized with switches and other associated buttons generated huge amount of traffic which severely impacted insteon performance. In a fairly large insteon installation as mine this created a huge problem. Since then, I have removed all but one KPL and moved a lot of devices to z-wave (especially wireless) and now my system is very stable. I still get occasional Insteon issues where devices don't respond (without Indigo knowing), but it is very rare now.

Posted on
Sat Nov 05, 2022 10:10 am
geowar offline
Posts: 7
Joined: Apr 27, 2022

Re: How to control keypadlink buttons from python?

Just an FYI: I noticed that for keypad link…

Code: Select all
indigo.dimmer.setLedState("myKeypadlink", index=3, value=True)
should be

Code: Select all
indigo.relay.setLedState("myKeypadlink", index=3, value=True)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests