Multi / long press transformation profile for rocker switch

logo

Transform button presses on a rocker switch to a detailed String.
Handle multi press, or long press.

See sample actions and resulting commands :

  • “button1” press and immediately release —> “button1.1”
  • “button1” press and release three times in rapid succession —> “button1.3”
  • “button2” press and release four times in rapid succession → “button2.4”
  • etc…
  • Press “button1” during two seconds, then release → “button1.0” + “button1.0” + “button1.0” + “button1.0” (one command with “0” suffix, every 500 milliseconds)|

Changelog

Version 0.1

  • initial release for openHAB 3.3.0

Resources

I didn’t really succeed in using the profile. After installing I can only select the standard profiles for all channels of my switches
Maybe I’m missing some necessary conditions? Is it only applicable for a certain kind of binding (e.g. EnOcean) or a certain channel like a rawToggle or a rawButton? Unfortunately all my light switches (where I wanted to use it) only provide a state channel by the binding. Could you please give me a hint?

Yes indeed, it is applicable to a rocker switch only. I use it for my EnOcean switch, I don’t know if any other manufacturer has a “RawRocker” channel on their device.
Basically, the profile needs two events sent by the device : a “press” and a “release” events.
If there is other devices who provide this kind of events (even with a different name), I could probably add it ?
But I don’t think a “basic” light switches send these kind of commands. (Sometimes they directly send Increase/Decrease command when long pressed, but no details on the press and release timestamp)

Anyway, what is your use case ? Multi press, long press, both ?

(I edited the open post to mention that a documentation is available with the source code)

My use case would be to get double or triple clicks from a remote control (it controls shutters and some lights).
Your profile would be much more elegant than handling that with a rule
You’re right that it doesn’t transfer a release event, only ON and OFF.