Properly recognize click, double click and longpress

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Properly recognize click, double click and longpress

#1 Post by mackowiakp » 04 Sep 2020, 07:29

I want to use push-on (monostable) switch to change radio channels oan on/off via Domoticz. Single click, channel up/turn on, double click channel down, longpress - radio off

The switch setup on the picture below:
Screenshot_20200904_072159.png
Screenshot_20200904_072159.png (98.22 KiB) Viewed 6860 times
The problem is case of double-click, it first generate event value "1" and than "3". And respectively after longpress, it generate "1" and then "11".
Is any way (by rule or script in Domoticz) to eliminate first "1" value event in case of double click or logpress?

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Properly recognize click, double click and longpress

#2 Post by Ath » 04 Sep 2020, 07:45

What version of ESPEasy are you using?
/Ton (PayPal.me)

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Properly recognize click, double click and longpress

#3 Post by mackowiakp » 04 Sep 2020, 08:39

ESPEasy_mega-20191208, because this version works perfectly for me, without any HW/SW/Watchdog-reboot. And I will not change anything that works perfectly for me.

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Properly recognize click, double click and longpress

#4 Post by TD-er » 04 Sep 2020, 09:39

Well the rules or switch plugin has not really changed a lot in this regard I think, since end of 2019.
I guess the rules are only a bit more strict now, so what works on the last builds will very likely also work on that build (other way around is not guaranteed)

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Properly recognize click, double click and longpress

#5 Post by mackowiakp » 13 Sep 2020, 09:19

I solved the problem by using the "inotifywait" command in the Domoticz bash script.
Nevertheless, I leave the following possibility for easyESP developers to consider. E.g. Add a checkbox in the switch definition.
And if this checkbox is checked and if the use of a button with double-click and/or longpress functionality is defined, wait the time defined for double click or longpress (whichever is longer).
And only after this time generate the appropriate result code (event) 1, 3, 10, 11 etc.
This will make it much easier IMO to use the button functionality correctly.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 124 guests