Dim light via switch


I’d like to achieve the following: Press+hold on button connected to a Shelly 2.5 increases the light brightness slowly, a second press+hold decreases the brightness again

Is there a way to achieve this with a Shelly 2.5 connected to the switch and a light running esphome? I can install Tasmota on the Shelly sending press+hold start and end events via mqtt. But I have not solved how to stop a brightness transition.

I have a similar setup working nicely with shelly 2.5 (running tasmota) + zigbee light connected to zigbee2mqtt. But zigbee2mqtt allows to trigger a brightness transition and also to stop it again.