How To: Using switch as dimmer (Shelly4 mini + Hue Bulb)

Hi there!

I have a shelly mini gen4 and a hue bulb and want to use the switch as a dimmer. when I hold the button it should brighten up 5% every second and when I release the switch and press it again it should go darker the same way. I don’t manage to do it on my own and was wondering whether I can get help here. I manage to do it without the loop, so that It goes up or down by 5% but not in a loop every other second.

Excellent question. I did multiple attempts of the same issue, but got no working results. Looking forward to some well-grounded answers!

Have a look at Controller - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer | Awesome HA Blueprints

It is originally for a zigbee switch, but it shouldn’t be too hard to adapt and modify it to your own needs.