Tap/double tap/tap&hold solution


#1

Hi,

I would need some help how to solve the user interaction with the wall switches (not existing at the moment, I’m in a planning phase).

I would like to identify tap, double (or multiple) tap and tap&hold. Single and multiple taps are not a real issues at all, but the tap&hold is still a big unknown to me.

The usage scenario for the tap&hold is something that is - for sure - already solved:

  • light dimmer (dimming slowly while I hold the button)
  • window blinds (rotating/sliding until while I hold the button)
  • audio volume settings

Any idea? What are the propper events to generate via the switch?

  • tap_hold start + tap_hold end
  • repeating tap_hold_active for example every 0.2s

How to integrate that event to HA?

How tointegrate similar functionality to HA frontend?

I think I’m hardly the first one to solve something similar because same use cases would be at every second HA installation…


#2

I don’t think there’s a generic solution for this problem, because it depends on the used hardware what type of events are supported and fired. Some devices just fire the same event multiple times when you hold the button, others publish something like press_long followed by press_release when you let go of the button. So to get further assistance you have to let us know what kind of buttons you consider to use.


#3

Diy solution. So I am looking for some best practice.

If repeated events are triggered, I’m afraid a can flood the bus with it (not tested yet how often is often enough to kepp the “responsive” feeling. WAF to be considered here)

If start/stop is the way to go, are there any downsides? Maybe some timeout needs to be set if no stop event is received after a period of time after start event…

The HA implementation is i big unknown for me, in both cases.