openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

[InsteonPLM] [feature] Mini Remotes - Fast On/OFF + dimming (start stop) #5493

Open SwissKid opened 6 years ago

SwissKid commented 6 years ago

Expected Behavior

For mini-remotes (both 4 button and 1 button) t'd be nice to have the dimming and double-tap (fast on/off) behavior handled and passed to other "things." I'd actually prefer if it mapped to a separate item than the current #buttonA and such - #buttonAF for fast and #buttonAD for dim maybe? That way I can effective change each button into 3 - the "hold", "single press" and "double press"

Current Behavior

Currently, all but the single tap are ignored.

NickWaterton commented 6 years ago

You can implement this yourself through the "additional features" feature of the binding. See https://www.openhab.org/v2.3/addons/bindings/insteonplm1/#troubleshooting section "Adding new device features"

I had added the faston/off feature for the mini remote: I added a file called more_devices.xml with a new device like this:

 <device productKey="F00.00.10">
     <model>2342-2</model>
     <description>Mini Remote</description>
     <feature name="buttonA">RemoteButton1</feature>
     <feature name="buttonB">RemoteButton2</feature>
     <feature name="buttonC">RemoteButton3</feature>
     <feature name="buttonD">RemoteButton4</feature>
     <feature name="buttonAF">FastOnOffButton1</feature>
     <feature name="buttonBF">FastOnOffButton2</feature>
     <feature name="buttonCF">FastOnOffButton3</feature>
     <feature name="buttonDF">FastOnOffButton4</feature> 
     <feature name="lastheardfrom">GenericLastTime</feature>
 </device>

This adds the faston/off functions (overwriting the original device definition) You have to add a "FastOnOffButton1" feature as that seems to be missing from the features.xml file. My file is called "more_features.xml" and you add this:

<feature name="FastOnOffButton1">
    <message-dispatcher>DefaultDispatcher</message-dispatcher>
    <message-handler cmd="0x12" group="1" mode="FAST">LightOnSwitchHandler</message-handler>
    <message-handler cmd="0x14" group="1" mode="FAST">LightOffSwitchHandler</message-handler>
    <command-handler command="OnOffType">FastOnOffCommandHandler</command-handler>
    <poll-handler>NoPollHandler</poll-handler>
</feature>

My items now looks like this:

Switch  miniRemoteBackGarden2ButtonD  "Awning"           <switch>    (MiniRemote6)   {insteonplm="44.B5.6C:F00.00.10#buttonD", autoupdate="false"}
Switch  miniRemoteBackGarden2ButtonDF "Awning Stop"      <switch>    (MiniRemote6)   {insteonplm="44.B5.6C:F00.00.10#buttonDF", autoupdate="false"} //faston_off control

And you can access faston/off separate from normal on/off using the two different items (just button D shown in the example above).

You can do exactly the same thing to add dimming control also, I haven't implemented that as I don't need it right now, but you can add the ManualChangeButton1/2/3/4 feature, and add it for each group (again you would have to add the ManualChangeButton1 feature, as it's missing).

<feature name="ManualChangeButton1">
    <message-dispatcher>DefaultDispatcher</message-dispatcher>
    <message-handler cmd="0x17" group="1">StartManualChangeHandler</message-handler>
    <message-handler cmd="0x18" group="1">StopManualChangeHandler</message-handler>
    <command-handler command="DecimalType">ManualChangeCommandHandler</command-handler>
    <poll-handler>NoPollHandler</poll-handler>
</feature>

OK, added dimmer as well:

 <device productKey="F00.00.10">
     <model>2342-2</model>
     <description>Mini Remote</description>
     <feature name="buttonA">RemoteButton1</feature>
     <feature name="buttonB">RemoteButton2</feature>
     <feature name="buttonC">RemoteButton3</feature>
     <feature name="buttonD">RemoteButton4</feature>
     <feature name="buttonAF">FastOnOffButton1</feature>
     <feature name="buttonBF">FastOnOffButton2</feature>
     <feature name="buttonCF">FastOnOffButton3</feature>
     <feature name="buttonDF">FastOnOffButton4</feature>
     <feature name="buttonAD">ManualChangeButton1</feature>
     <feature name="buttonBD">ManualChangeButton2</feature>
     <feature name="buttonCD">ManualChangeButton3</feature>
     <feature name="buttonDD">ManualChangeButton4</feature>
     <feature name="lastheardfrom">GenericLastTime</feature>
 </device>

For completeness, items now looks like this:

Switch  miniRemoteBackGardenButtonD  "Awning"           <switch>    (MiniRemote5)   {insteonplm="3F.42.11:F00.00.10#buttonD", autoupdate="false"}
Switch  miniRemoteBackGardenButtonDF "Awning Stop"      <switch>    (MiniRemote5)   {insteonplm="3F.42.11:F00.00.10#buttonDF", autoupdate="false"} //faston_off control
Number  miniRemoteBackGardenButtonDD "Awning Stop"      <switch>    (MiniRemote5)   {insteonplm="3F.42.11:F00.00.10#buttonDD", autoupdate="false"} //manual dimmer control

Notice the manual increase/decrease is a Number (not a switch), as you get 1 for stop, 0 for decrease, and 2 for increase (ie you get a 2 for increase, then when you release the button, you get a 1). You could use this in a rule though.