I created a button application that makes a single button to control arbitrary number of devices and trigger routines. A button can either pushed or held that is used as morse code (./-). A morse code is assigned to a device and the button used to generate the morse code to toggle the device state or trigger a routine.
This app can be used to toggle a switch/lock/alarm or trigger a routine. I am putting it here in case anyone looking for something like this.
Okay, not sure what is the cause, but presses with my button require one second between each press to register multiple events. Getting long presses to work is challenging at best. I can’t seem to time it right most of the time, but short presses seem to work okay.
I had the same luck with Xioami button as well. What worked well for me is setting the hold time about 1 sec and setting the action time about 3 sec. And brief pause between two push/holds works better. I dig into the issue the the common DTH for Xioami button issue two asynchronous event one to declare the button down and the second to end of the button down. These are asynchronous event, so no guarantee they will be delivered in order. If you push or hold too quickly the event order might not be correct. So, if you are using Xioami button, you have to take is slow