One-stop linking a KeypadLinc button to a plugin device

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: One-stop linking a KeypadLinc button to a plugin device

Post by jay (support) »

Correct - you won't see any change because there wasn't one. You can, of course, subscribe to incoming INSTEON commands and watch for button presses that way. It's not documented well but there's a very simple Example INSTEON/X10 Listener plugin in the SDK that illustrates it's use. The cmd parameter to the insteonCommandReceived method illustrated in the example is a dict:

Code: Select all

ackValue : 0
address : 22.F7.44
cmdBytes : [17, 0]
cmdFunc : on
cmdScene : 3
cmdSuccess : True
cmdValue : 0
replyBytes : []
cmdScene is the button #.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: One-stop linking a KeypadLinc button to a plugin device

Post by kw123 »

I did the interface ... change, seems to work: device sends only one "off" messages and no message to the device to set it back to "off" is needed.
One side effect is that every time a button gets press it blinks 3 times - for about 2 seconds- then goes to off status. .. is this a "feature"?
Not a big deal, but is this the way it should be?

thx

Karl
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: One-stop linking a KeypadLinc button to a plugin device

Post by jay (support) »

Yep - that's feedback to let you know you pressed the button.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
hamw
Posts: 1342
Joined: Mon Mar 31, 2008 7:45 pm

Re: One-stop linking a KeypadLinc button to a plugin device

Post by hamw »

Would a general solution include "One" of the Holy Grails of home automation: multiple events/single trigger?
Perry The Cynic
Posts: 857
Joined: Mon Apr 07, 2008 9:46 pm

Re: One-stop linking a KeypadLinc button to a plugin device

Post by Perry The Cynic »

You can, of course, subscribe to incoming INSTEON commands and watch for button presses that way.
Well, I've got that more-or-less working. Questions:

Do I need to worry about cmdSuccess in incoming INSTEON commands being False, and if so, what am I supposed to do about it - ignore it? Yell at the user?

Is there something problematic about calling indigo.server.turnOn from inside an insteonCommandReceived handler? When I do, I get frequent "send failed (no acknowledgment)" errors. Adding a one-second delay solves the problem, but of course isn't nice for responsiveness. (And it really needs to be almost a full second; delaying by 0.3 seconds doesn't seem good enough.)

Is there any way my plugin can find out that a turnOn/turnOff command has failed, so it can retry it? (Short of issuing a state query, at least, or filtering the event log for errors.)

Cheers
-- perry
Dewster35
Posts: 1033
Joined: Tue Jul 06, 2010 6:29 pm
Location: Petoskey, MI

Re: One-stop linking a KeypadLinc button to a plugin device

Post by Dewster35 »

hamw wrote:Would a general solution include "One" of the Holy Grails of home automation: multiple events/single trigger?
The switchboard plugin already does this to some degree with certain devices. Not a KPL solution by any means, but a similar idea.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: One-stop linking a KeypadLinc button to a plugin device

Post by jay (support) »

Perry The Cynic wrote:Do I need to worry about cmdSuccess in incoming INSTEON commands being False, and if so, what am I supposed to do about it - ignore it? Yell at the user?
Pretty sure you can just ignore it. If you were to receive a failure I'm not sure you could do anything about it anyway.
Perry The Cynic wrote:Is there something problematic about calling indigo.server.turnOn from inside an insteonCommandReceived handler? When I do, I get frequent "send failed (no acknowledgment)" errors. Adding a one-second delay solves the problem, but of course isn't nice for responsiveness. (And it really needs to be almost a full second; delaying by 0.3 seconds doesn't seem good enough.)
So, yeah, it's sometimes going to be a problem because it's likely that the INSTEON cleanup messages from the command are still floating around - the delay gives them a chance to complete. A delay is your only option or you'll get collisions.
Perry The Cynic wrote:Is there any way my plugin can find out that a turnOn/turnOff command has failed, so it can retry it? (Short of issuing a state query, at least, or filtering the event log for errors.)
There is no direct way to see if the last command to a device completed successfully on INSTEON devices yet - but it's something we want to get in at some point (not before Indigo 6 GM though).

Until then, I suppose you could subscribe to device updates - then issue the command and add it to a queue internal to your plugin and wait for a device update. If you don't get one within a couple of seconds then assume it failed and try again.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Perry The Cynic
Posts: 857
Joined: Mon Apr 07, 2008 9:46 pm

Re: One-stop linking a KeypadLinc button to a plugin device

Post by Perry The Cynic »

So, yeah, it's sometimes going to be a problem because it's likely that the INSTEON cleanup messages from the command are still floating around - the delay gives them a chance to complete. A delay is your only option or you'll get collisions.
Interesting. I was assuming that Indigo would queue INSTEON commands to avoid collisions on its own. Not true? There's no collision procedure on your side?

Cheers
-- perry
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: One-stop linking a KeypadLinc button to a plugin device

Post by jay (support) »

We do that - when the PowerLinc reports no activity then we send whatever is next in the queue. The problem happens after that - when the PowerLinc puts the command on the line at the same time the other device puts it's cleanup message on the line you get a collision. INSTEON's lower-level implementation doesn't handle collisions well at all and we're doing about as much as we can to deal with it.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Locked

Return to “Extending Indigo with Plugins and Python”