I have actually been working on this for a bit of late, so maybe what I have done can be of use for you.
I am using a Xiaomi button that has the long-press function and an IKEA Tradfri bulb, I am also using the transitions app that @viix suggested.
On long-press, I check what the DimUP boolean is saying (true = dim UP), if it is true I start a transition from the current dimlevel of the bulb to 1 in 5 seconds with 0.5s steps. If it is false, I go to 0.
At the same time I tell the bulb to start dimming to 100% (or 0%) in 5 seconds as well.
This only dims to full or off, so to stop the dimming something needs to happen when the button is released. Which is my next flow; I stop the transition and toggle the up/down so next time I dim the other way. (Forget the paper trail card, I need to tak ethat out still)
Now for the actual setting of the final dim-level, I created a third flow that takes the value that is in the transition and set it as the dim-level, only this time I dim to that immediately;
Initially, I had another flow to change the dim-level immediately every time the transition value changed but that meant that the dimming level would “jump” to the next value which I didn’t like; this way it is a lot smoother and there is only a small “jump” when you release the button.
Hope that helps,
Matthieu