I tried several existing blueprints and none worked as I wanted. Here is my take on it.
See description for the details.
To have different actions on short press and on hold (long press), use ‘button release’ (
*_press_release) and ‘button hold once’ (
*_hold_once) commands, as ‘press’ (
*_press) will always trigger before ‘button hold’ (
When you hold a button, ‘button hold’ (
*_hold) command is repeated roughly once per second. This may not work as desired with actions like toggling light/switch.
If you want an action to run only once when the button hold action is registered, use ‘button hold once’ (
*_hold_once). It’s better than using ‘button hold release’ as the result can be observed before releasing the button after holding.
As ‘button hold’ action is repeated by the device while you keep holding the button, it’s a good way to run actions which increment / decrement some value (such as light dimming).
To make it react as soon as the button is pressed, copy the same action to ‘button press’ (press action occurs immediately, while hold action occurs after a delay).
Make sure to manually create a separate Text Helper per dimmer device and define its entity in the automation. It’s used to store the last controller event to filter possible empty events and handle ‘button hold once’ actions.