Hi all,
Similar to other solutions here, I have made a dimmer for the Ikea Trädfri switches, in my case with Deconz. https://github.com/tnagels/tradfri_dimmer
It supports the little square switch and the round one with many buttons. Short press switches on/of, long press dims. On the round one I have put this functionality on the brighter/darker buttons only as I use the other buttons for other functions as well (ventilation).
Feel free to use/modify/copy it.