Using a MQTT wall switch to dim MiLight

Hi all!

I’m trying to create a 2 button wall switch to control my MiLight in my kitchen.
I would like these features:
Press button 1: Turn on lights
Press button 2: Turn off lights
Hold down button 1: dim up MiLight
Hold down button 2: dim down MiLight

…but I’m not sure how to implement the dimming part.

Any suggestions?

I would create a MQTT sensor in HA and automations for when its value is ON, OFF, UP and DOWN. The rest would be in your arduino code to handle the buttons press and send the respective messages.


That’s the easy part and not really what I wondered, but thank you for your answer!

I would like the lights to dim down as long as I press the button, and respectively, dim up as long as the other button is pressed down.
One solution right now would be to have two MQTT commands per button; “down-start”, “down-stop” respectively “up-start”, “up-stop”.

The question is, how should I implement this in home assistant. I would need some kind of script which will continuously send brightness up to the milight until the next “*-stop” command is received.

I hope I explained my idea more thorough this time.
Any help is appreciated! :smiley: