Home Assistant adds a held-button trigger for button event entities. An automation can run when a long press starts, or on release for devices that only report the hold then.
For buttons that report both the start and end of a long press, an optional interval repeats the trigger while the button remains held. Each run includes a repeat count. Repetition stops on another button event or when the entity becomes unavailable, and a thirty-second limit prevents a lost release message from leaving it running indefinitely.