But apparently (I noticed in the logging) the switch always gives a short press signal, regardless of I press long. Knowing this, I just need to check if no long press is following the short press.
The example you mentioned is not what I want to do.
As @s73nm suggested I created a variable ‘long pres is hold’ witch is changed to YES as soon the button is long pressed. Releasing the button changes it back to NO.
As long as the button is hold the flow restarts itself every 1 second.
Theoretically you could dim all the way down 0%. If so a single press will dim the light to 20%. Otherwise it will toggle the light.
Your flow changes the dim direction at 0% and 100%. My flow changes the direction at every button release.
It could be that the 1 second delay is confusing, and would result users to press the button a second time. If this is the case, you could also opt for the following:
On long press, do what is needed for a long press
On the short press, don’t take any action except start a stopwatch. E.g. using the chronograph app.
On the release of the button check the time that has passed (and stop the stopwatch). If less than 1 second has passed, toggle the lights. If more than 1 second has passed, execute anything else that is needed for the long press.
Just a note: with unknown buttons I usually learn which events do they send and when by setting a up flow to send me a message to Telegram with the event name. Or an action per event to send corresponding message.