@mocelet, I’m trying to figure out how to enable gradual brightening and dimming via holding down a button, using the current technology, with LIFX Matter bulbs, while minimizing virtual devices. (LIFX floods the hub when doing a native transition, so we need to do stepwise dimming.) In addition to the LIFX Matter light (running your driver) and the Zooz ZEN37 scene controller (running the Zooz driver), I believe I have it down to two virtual devices: one Scene Switcher for brightening, and one Scene Switcher for dimming. Each Scene Switcher goes into Auto-Cycle On mode when a button is held down (repeatedly triggering through scene 1, up to a maximum number of times specified in the settings) and Auto-Cycle Off mode when the button’s held (released) event occurs.
Since my hub is getting full, I would like to reduce the virtual devices. I devised this combination and want to see if it will work. Suppose that the Scene Switcher runs in 10% brightness increments. In that case, we can combine the two Scene Switchers into one Scene Switcher with scenes 1-20. Cycle mode is is set to “Linear. Will not loop”. Switching delay is set to personal preference, but in my case I observe reasonable results for 800ms to 900ms.
There are two routines: one routine that says that when the scene is less than or equal to 9, then step -10%. Another routine says that when the scene is greater than or equal to 12, then step +10%. When the dim button is held down, a routine first sets the target Matter lights to step -10%, then sets the scene to 10 (which does not trigger any dimming, since scenes 10 and 11 are not preconditions to any step dimming action), and then starts “Auto-Cycle [ < ]“.
The idea is that immediately when a button is held down, the first thing the hub ought to do is step-dim the lights. Then, it starts auto-cycling from scene 10 down to scene 1, which means that additional step dimming will occur 9 times, each time reducing the brightness by 10%. There is no harm in the Scene Switcher running too many times because once the brightness gets to 0%, additional step dimming calls will just have no effect.
Repeat logic for brighten button but +10% on each step. On button held down: step +10%, then set initial scene to 11, then turn “Auto-Cycle [ > ]”.
For both dim and brighten buttons: when the button is released, set “Auto-Cycle [ STOP ]”.
There is a little corner case where a user holds down the Dim button, and then while continuing to hold it down, presses and hold the Brighten button. The behavior is more-or-less as expected: the light will dim a bit, then brighten continuously until the user releases either one of the Dim/Brighten buttons. When one of the buttons is released, the brightening should stop.
Does this approach sound correct/the best, at least until LIFX stops flooding the hub with color change notices?