[ANSWERED]Correct/Best Practice - Trigger Config for KPL ...

Posted on
Tue Jul 08, 2014 11:50 am
ArthurD123 offline
Posts: 28
Joined: Jun 23, 2014

[ANSWERED]Correct/Best Practice - Trigger Config for KPL ...

I'm trying to figure out what the best, simplest (really just fewest triggers & config steps) way to handle keeping several buttons in sync, both when used physically and when used via Indigo.

For KPL buttons that control 'scenes', groups of lights/devices that would be turned on/off in unison. Examples of 'scenes' (not INSTEON groups/scenes) like this are stuff like "Party Mode", "Night Mode", "Away Mode", "Watch Movie", etc...

My process right now for this is:

-Use INSTEON Device Links to sync the appropriate KPL buttons via INSTEON; keeps physical button pushes instantly in-sync.
-Create 2 Indigo 'Action Groups' per desired Indigo "scene" / button action (1 for ON, 1 for OFF) which:
a) does the actual actions to turn the "scene" on/off
b) turns on/off the proper KPL buttons as needed; ensures that Indigo-fired 'scenes' keep buttons in-sync
-Create 2 "INSTEON command-received" triggers for EACH of the appropriate KPL buttons (ie two per KPL button that controls the same 'scene'), each of which which calls the appropriate ON or OFF action group for the scene.

This seems to work just fine at the physical buttons, and from Indigo as long as I only use the Action Groups to turn the scene on/off which for scenes is no issue. Obviously if I manually change stuff at each device (or via Indigo for each device), the KPL LEDs don't reflect that status, but that's expected and just fine. Worst case, I can change to non-toggle mode and have a double-tap be OFF and a single-tap be ON and then button LED states are a non-issue but typically I'm OK with having a "Party" button that toggles, off just turning off the relevant lights if they happened to still be on...

Some Qs:

1) One downside here I think, is that the Action Groups update ALL the KPL button states -- but most of the time at least 1 of the KPLs is already "in sync" (ie it was a physical button push), so this may be adding extraneous INSTEON traffic to my network which could be avoided?

2) KPL buttons that control a single device [whether it be a virtual device, an X10 device, or an INSTEON device] -- these work fine if controlled physically but if controlled from Indigo and NOT via the respective Action Group, then things get out of sync. One solution is to add yet another trigger based on Device State which then calls the appropriate Action Group to sync things up. Some potential issues I see with this:
A) It's potentially a hell of a lot of triggers to setup if you've got a couple of different ways/devices that control the device.
B) I am concerned that I could end up with an 'infinte loop', especially for virtual & X10 devices. The KPL-button-press trigger fires, action group changes device state, then the device-state-based trigger fires as well... I suppose I could use two additional triggers here that instead set a variable, then change my proposed "onDeviceStateChange" trigger to instead be a "onVariableChange" trigger, but again then I'm yet again adding more triggers which I'd like to avoid given 8 KPLs -- my goal is largely to not require hundreds of triggers just to keep my KPLs in sync...

What's the best practice for setting something like this up? I'm close to just jumping into Python for a day or two and writing up some classes but was really hoping to get majority of my stuff done without it, and have gotten probably ~30% of my stuff done already, though do have some "gaps/issues" remaining related to state & esp. WRT my concerns about extraneous INSTEON traffic & infinite loops...

Hrmmmm -- any advice for this semi newbie Indigo/HA user would be appreciated! FWIW, I'm a software engineer by trade! =D

-AD

Posted on
Tue Jul 08, 2014 1:34 pm
jay (support) offline
Site Admin
User avatar
Posts: 18260
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

ArthurD123 wrote:
1) One downside here I think, is that the Action Groups update ALL the KPL button states -- but most of the time at least 1 of the KPLs is already "in sync" (ie it was a physical button push), so this may be adding extraneous INSTEON traffic to my network which could be avoided?


If you use PowerLinc groups, and add all buttons that should stay in sync to a group - then when you want to turn a button on/off you'd just send the ON/OFF to the right group. This is more efficient because the PowerLinc only needs to send a single command to the group rather than individual commands to each KeypadLinc.

ArthurD123 wrote:
2) KPL buttons that control a single device [whether it be a virtual device, an X10 device, or an INSTEON device] -- these work fine if controlled physically but if controlled from Indigo and NOT via the respective Action Group, then things get out of sync. One solution is to add yet another trigger based on Device State which then calls the appropriate Action Group to sync things up. Some potential issues I see with this:
A) It's potentially a hell of a lot of triggers to setup if you've got a couple of different ways/devices that control the device.
B) I am concerned that I could end up with an 'infinte loop', especially for virtual & X10 devices. The KPL-button-press trigger fires, action group changes device state, then the device-state-based trigger fires as well... I suppose I could use two additional triggers here that instead set a variable, then change my proposed "onDeviceStateChange" trigger to instead be a "onVariableChange" trigger, but again then I'm yet again adding more triggers which I'd like to avoid given 8 KPLs -- my goal is largely to not require hundreds of triggers just to keep my KPLs in sync...


Actually, aside from direct linking, this is the recommended approach. Create triggers that watch for whatever condition would cause a KeypadLinc LED to go on/off, then fire off the PowerLinc group to set the LED appropriately. You don't have to bother with any additional state logic since, as explained above, executing a PowerLinc group is not (in and of itself) network intensive. In terms of additional traffic of the sync vs the LEDs being automatically set because of direct linking - at most it would issue the command twice (once with the direct linking and once with the device state change trigger).

We understand that currently, KeypadLinc LED management always a simple task, and improving it is on our feature request list. It is something that we have gradually improved (in Indigo 6 the addition of the Device Group was a decent step in the right direction) and will continue to look at. Your scenario though, where you seem to have a lot of KeypadLincs that have a lot of duplicate functionality, is somewhat an edge case from what we've heard from most customers, so perhaps it's a bit more painful for you than most. Take heart that once it's done, it's done and will likely not require much fiddling (again, that's our experience).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 08, 2014 1:53 pm
ArthurD123 offline
Posts: 28
Joined: Jun 23, 2014

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

Thanks a bunch Jay -- really helpful even just corroborating my approach, especially since I've tried 3-4 different methods, most of which have worked, but have felt wayyy too complex and/or tedious.

Pretty sure on this but to confirm, this will avoid any infinite loop issues as well because the trigger is listening for the specific button pushes (one trigger per button) while the button LED states are being managed by the PowerLinc group, right? And for physical button pushes, the INSTEON Device Link handles state but the KPL still sends out the button push as well (ie the protocol has the KPL send out a "button push" command which the other KPLs receive for state update + Indigo receives it, activates trigger)?

Assuming the above is correct, then I should be left with only having state issues for my pool controls (spa mode primarily, which does a few things and is via X10). And for those, I should be able to solve it via a virtual Device Group and/or a variable, likely will be fine with the former and should be a bit cleaner...

Thanks again!!

Posted on
Wed Jul 09, 2014 9:23 am
jay (support) offline
Site Admin
User avatar
Posts: 18260
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

ArthurD123 wrote:
Pretty sure on this but to confirm, this will avoid any infinite loop issues as well because the trigger is listening for the specific button pushes (one trigger per button) while the button LED states are being managed by the PowerLinc group, right? And for physical button pushes, the INSTEON Device Link handles state but the KPL still sends out the button push as well (ie the protocol has the KPL send out a "button push" command which the other KPLs receive for state update + Indigo receives it, activates trigger)?


I'm a bit confused - the goal here is not to keep buttons in sync when they're physically pressed - that happens automatically because the buttons have been linked together. The outstanding problem is how to sync the buttons when conditions change such that the buttons need to have their state updated. If you're dealing strictly with devices that support an ON/OFF state, then putting them into a device group and just triggering button updates based on the device group's state would be the best way.

What am I missing?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 11, 2014 10:04 am
ArthurD123 offline
Posts: 28
Joined: Jun 23, 2014

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

I suspect you're not missing anything -- I think I'm just over-planning and under-implementing. Going to be programming the rest of my KPL buttons today, so far so good at this point, will report back if any issues but I think I'm on pretty solid ground at this point.

My only concern right now is infinite-loops but after further consideration I *think* that's a non-issue if approached the way outlined above. Will know very soon though.

Thanks again for the guidance! Apologies for the newbie-ish / over-planning Qs! =)

Posted on
Wed Jul 16, 2014 9:51 pm
jltnol offline
Posts: 998
Joined: Oct 15, 2013

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

Ok ok.. .so I'm beginning to see the KeypadLinc Group way of keeping KPL LED's in sync. 8)

I'd still like to use a version of this script, the IF part, as this will work with one trigger as opposed to two, but substitute the individual KPLs with a line of Python code that would turn On or Off the KeypadLInc Group..


Code: Select all
if (indigo.devices[1617447201].onState == True): # Test "myNewDevice" state...
        indigo.dimmer.setLedState(1438815089, index = 2, value = True),  indigo.dimmer.setLedState(418713206, index = 5, value = True),  indigo.dimmer.setLedState(215921706, index = 5, value = True)
else:
        indigo.dimmer.setLedState(1438815089, index = 2, value = False),  indigo.dimmer.setLedState(418713206, index = 5, value = False),  indigo.dimmer.setLedState(215921706, index = 5, value = False


I have no idea how to find the ID of the Group, or what to use if there isn't one.... Is this possible ? Or do I need to set up an Action Group to activate the KeypadGroup?

Posted on
Thu Jul 17, 2014 8:45 am
ArthurD123 offline
Posts: 28
Joined: Jun 23, 2014

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

So far I've been mostly using two triggers for this but am planning to switch over to basically what you outlined there.

As far as triggering INSTEON scenes from Python, it looks like this page is what you're looking for:
http://wiki.indigodomo.com/doku.php?id= ... c_commands

Along the lines of one of these, depending on your requirements:

Code: Select all
indigo.insteon.sendSceneOn(11)
indigo.insteon.sendSceneOn(11, sendCleanUps=False)
indigo.insteon.sendSceneOn("working in office scene")


The numbers would then correspond to the PowerLinc's INSTEON Scene ["group"] numbers...

Posted on
Thu Jul 17, 2014 10:06 am
jltnol offline
Posts: 998
Joined: Oct 15, 2013

Re: Correct/Best Practice - Trigger Config for KPL Button Sy

And..
Code: Select all
indigo.insteon.sendSceneOff(11)


works to reverse the action!

This is clearly easier and more efficient that what I had cobbled together!

THANKS

(and I'm just realizing this can be done thru the GUI just as easily)....

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest