Hi Marc,

Thank you for help and explaining this further.  I finally got this working with the code you pointed to.  And I had to link the scene to the button as described in the thread you referenced (Browse Categories > Insteon > [scene name] > initiate linking as controller).

I think my confusion was caused by the wording in the wiki about this, after the first insteon.mht example in the "Basic scenes with KPLs" section:

"Now, anytime 'myscene' is set on or off from MH, the KPL button B will also be set on or off along with the light, and anytime the light is locally controlled, the KPL button will reflect that change"

From this, it appears that the lines in insteon.mht are all that are needed for this functionality.  It wasn't obvious to me that the tie code was needed to make this happen.  Or that I had to link the scene to the button.  Perhaps the wiki can be made more clear, if this question comes up often about the KPL buttons?  Just a thought..

Again, thank you!  I've been trying to figure this out for a while.


From: Marc MERLIN <marc_mh@merlins.org>
To: Ray Yeung <ryeung8@yahoo.com>; The main list for the MisterHouse home automation program <misterhouse-users@lists.sourceforge.net>
Sent: Friday, February 10, 2012 6:23 AM
Subject: Re: [mh] Can't get KPL button backlight to update with scene

On Sun, Feb 05, 2012 at 07:53:27AM -0800, Ray Yeung wrote:
> Hello,
> I have an ApplianceLinc controlling a floor lamp, which MH turns on and off when it gets dark.  I also have a KPL v5.5 which can control this lamp.  I understand from the wiki that I can create a scene which will update the button backlight on the KPL when MH turns on the lamp.  However, I can't seem to get this to work.  I can get the KPL button to control the lamp, MH knows the KPL button status, and the MH scene works.  Just the button backlight never turns on.

There are 2 ways to do this
1) surrogates, as explained in the insteon wiki. I've never really liked
the concept, they don't really make sense to me :)
2) create scenes for all your kpl led buttons, an a tie command as
explained in this thread:

The short version, something like this:
$fmr_outside->tie_event('sync_kpl_lights($fmr_outside, $fmr_outside_kpls)'); # noloop
$yard_lights->tie_event('sync_kpl_lights($yard_lights, $yard_lights_kpls)'); # noloop

# this will get called every time a switch is toggled locally and output:
# MYLOGKPL: sync_kpl_lights called for state_changed on $kitchen_kpl for $kitchen_kpls
sub sync_kpl_lights
    my ($ref_light, $kpl_scene) = @_;
    if ($ref_light->state_changed) {
        print_log "MYLOGKPL: sync_kpl_lights called for state_changed on ".$ref_light->get_object_name." to ".$ref_light->state." for ".$kpl_scene->get_object_name." set kpls in 1sec";
        # delay is to avoid collisions
        $kpl_scene->set_with_timer('', 1, $ref_light->state);

"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/