Thanks for this!
I was looking for the same solution. This made it.
As the topic title says: problems with sensor/ automations…
I’m having a problem using “the xxx_long_press” for dimming and brighten just like Finally - a cheap WIRELESS switch that dims! Xiaomi Switch Gen1
Thing is, i cant let it stop by releasing the switch. This is because there is no xxx_long_release or equivalent to _release. Any ideas how to get this around?