With the open-sourcing of Altsteon, I figured I would take a crack at the one remaining issue I have in my home automation setup: KeypadLinc button indicators getting out-of-sync with reality: light is off, but some KPL buttons controlling it remain lit. I’m an experienced C++ developer and so I’m hoping this is something I can help solve.
I’ve read on this forum in the past of some attempts to be able to control KeypadLinc button LEDs directly from Vera. These reports included KPL or PLC hangs – not really encouraging.
So I figured I’d report the results of my initial experiments. Using altsteon_cli and with the source as a reference, I’ve been able to reliably control the LEDs on one of my KeypadLincs. I haven’t experienced any hangs. The relevant commands are:
[ul][li] set_button_led 1 sets the button LEDs. Doesn’t work for button 1 (load), which goes on & off with the load instead.[/li]
[li] get_extended_devopts <button#> returns a lot of info, including bitmap state of button lights. Every button returns the bitmap of the whole device.[/li][/ul]
here is a 1-byte value with bit n corresponding to LED for button n (for an 8-button KPL, which is what I have. I believe 6-button KPLs simply omit buttons 2 & 8 ).
What this means is that there’s a syncronization problem here: if Vera were to retrieve the button-LED state as one command, alter it for the changed button, and then set that value as a second command, there’s a possibility some other button will have tried to update its state in between the two commands, and the resulting state would be incorrect. This may seem unlikely, except that a given scene is very likely to want to alter the LED state of multiple buttons.
So my feeling is that I should write some code in Altsteon daemon to include a model of the state of the button LEDs in the existing KPL model. This state would be updated with other KPL state by polling (like the other device state like dimmer level etc.), but more importantly, this modeled state could be used to provide an atomic “set button n LED on/off” command: this command would update the internal state, then set the KPL’s button state to match. With no synchronization issues.
My one real question, though, is: if I do this, am I likely to hit the same KPL or PLM hang issues that people have seen in the past? What sort of commands seemed to trigger these hangs?
Anyway, I’ve written much more than I intended as an introductory note here. I’d welcome any thoughts or additional information.
-Doug