A scheme to control tunable-white light bulb with a button that supports single click, double click, and optionally, hold/release (e.g. Xiaomi Aqara)

I have been using Xiaomi Aqara buttons to control my wifi lightbulbs. Some of the light bulbs support tunable white (i.e. cool to warm colour temperature).

There are two versions of the buttons, but each has only one button

  • One that supports single, double, triple and quadruple clicks
  • One that supports single, double, shake, hold and release

After many many iterations of how to control the lights, I’ve come up with the following scheme:

  • Single click: toggle on/off. If successive single clicks were made within 3s, cycle through: low, medium, maximum brightness - this gives the button without hold/release feature the ability to adjust brightness.
  • Double click: Cycle through: Warm and Cool
  • Shake or Triple clicks (depending on the button version): cycle through a list of pre-set colours - if supported by the bulb
  • Hold: Gradually dims / brightens the light until it reaches the dimmest (minimum) or brightest (maximum) level. When the minimum or max is reached, blink the light (so the person knows that it has reached the min/max level) and stop doing anything until released. The next time the button is held again, it will reverse the direction of the brightness.
  • Release: stop the dimming/brightening process, i.e. leave the light at the level it’s at.

What’s your question or problem?
Or if you don’t have a question or problem, but want to share your idea, please post the items and rules (with the use of code fencing).

I did have a question earlier but deleted the question because I figured I could live with it. I will post my code soon!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.