I have multiple buttons/remotes but there’s one place I want to do more than 3 actions with the middle button of an IKEA E1810 (I’m getting a Mi Wireless Switch soon, which allows many clicks, but I’d love to make it with the E1810).
In words:
I want to click the button, and allow 350ms for the next click to happen and be added to the final count. Up to 5 clicks.
If no further click happens in those 350ms, the final action is executed, based on the amount of clicks that happened (1-5).
So the total automation “duration” (wait time) can vary between ~350ms and ~1750ms
This works pretty much okay (not foolproof), but it forces me to wait 1.5 seconds even if I click only once, or clicking 5 times very fast if I want to reach 5 clicks in 1.5 seconds
That is why I want to change the approach to “add 350ms to wait time with each click” as explained above. I’m very open to ideas on the overall concept - I’m not the first attempting this but the threads I found were old or abandoned.
PS: I’d like to avoid things like ControllerX as this is only for one remote.
However, for some reason if the time between clicks matches the delay, the automation actions run twice (first and last, usually). It seems some delay in execution and counter reset might be playing with me. It shouldn’t happen though. I welcome any idea to mitigate this (as well as a completely different approach).
The traces could be able to tell you more about which invocations are double and what caused it. I suspect the restart may not always abort the previous run quickly enough. Maybe a condition that the state must have been as expected for at least 700 msecs above the switch would detect the delay in aborting the script?
Yeah that’s what I thought. Traces did show the actions being run but not enough time to reset the counter (restart triggered before it could). Thanks.
I guess you’re referring to the “For” section, but since it can’t be less than 1 second, it becomes too high
But you gave me an idea that seems to work! I placed the Reset Counter running In Parallel to each of the 5 actions. A bit more repetitive but hey, aparently it works (will test more).
Now I just need to figure out a cooldown period after it runs completely once (eg if clicks are over the waiting time - currently 700ms - the automation rightly fires twice).
Setting a delay at the end doesn’t work since it’s in Restard mode to allow its main purpose
Thank you, good to know! I also read this could be done with ControllerX.
For now I want to avoid overhead / new addons just for this very niche use-case for 1 remote, as I’m more than happy with HA Automations but I know I’m forcing it with this (and took it as a challenge), plus most likely getting a dedicated remote that can do this natively for 10€ (WXKG01LM)
Just a learning exercise that might help someone in my situation in the future