ZHA Double (and Triple) Click Experiments

If you are not using ZHA, then you will never see a zha_event trigger. According to the zigbee2mqtt documentation there isn’t an event, instead you have to trigger from an state change.

Thanks for sharing!

It actually took me some time to get it running as I’m quite a noob in HA, but I think I managed.

Important note which was missing is to add a counter! From Settings->Device&Services → Helpers → one needs to add a counter with ID “zha_button_click” with some min/max values (I used 0/20). Otherwise the script doesn’t work.

That’s a good point @lega4! At the time of this post, helpers could only be defined in the configuration.yaml file. That’s a nice reminder of how far Home Assistant has come.

I’m glad you were able to find it useful!

Hi,
I just wanted to say thanks Brian. This code you have shared looks very interesting and I hope to start using it pretty soon.
Regards Robert

Thanks, Brian! I successfully used your concept to set up a couple of Philips Hue Tap Dial Switches. I really appreciate your work!

Thank you, from the distant future. I used this to set up double- and triple click. For some reason I rarely get the triple clicks in though, even though I see them come through fast enough. I suspect that the issue is that the automation is reset before counter is incremented.

My fix is to add a second automation only for the counter which runs in parallel. In this automation I increment the counter, wait for three seconds and then reset it. Of course, it will be reset for every time I incremented it, but who cares? Otherwise I have kept your basic framework on the first automation, to wait half a second, read the counter and perform the action that corresponds to the achieved count. If another input is registered the automation restarts, only to prolong the time until the next press, but keep the wait between the last press and the actual action tolerably low.