I thought I’d share a node red script that I created to test the idea of using the config button on my blue 2-1 to enter different modes.
Motivation: My switches are used to control both smart lights, and shades. The switches are bound directly by zigbee to the lights to turn them on and off. I was previously using double tap up and double tap down to trigger the shades for a room to go up and down, through a home assistant automation that detected the action. However, I like to have my timings for detecting double taps very low to make the switch responsive, and other members of the family sometimes have trouble using this functionality. It’s also sometimes hard to tell what’s happening and easy to make a mistake (and easy to accidentally open or close a shade).
An idea I’ve had for a while was to use the config button to change “modes”, but since my lights are controlled by zigbee, it seemed a little more complicated.
What I’m using: Home Assistant, Zigbee2Mqtt, Inovelli Blue 2-1 dimmers
Solution:
In Node Red, I created a flow where I detect the LocalProtection state of the switch and use that to determine which “mode” I am in (shade mode vs regular mode). When a person double taps the config button, the LocalProtection state is switched to the other state.
When the LocalProtection state changes, I send an led_effect to change the color of the led to flashing purple to indicate I am now in “shade mode” (or alternatively clear the effect) and also update my state machine which will open or close the gate node that will allow button presses to control the shades.
When in shade mode, up and down single presses now control the shade and not the lights. In addition, if the user holds the up or down button, it will open or close and then send a “stop” command when the user releases. The latter doesn’t work very well because of the lag of sending the shade commands, so I might switch to a different approach.
However, I am very happy with this proof of concept and may expand it to other things (maybe more modes, like a scene selection mode, or a check status mode, etc.). Changing of modes happens very fast and seems very reliable. Because I check the state of the LocalProtection attribute when the flow restarts or is deployed, I also ensure that the script doesn’t get out of sync and knows what is happening with the switch.
I could clean this up more for sure, but wanted to figure out if this was really feasible. I’d also like to add a timer to disable the alternative local control disabled mode after a period of time (e.g. 2 minutes) if no buttons are pressed and the user forgets to do it. I probably don’t need the state machine node with the way I created this, but I like the visual display in the flow of the current state and it would be useful if I expand to more modes. Since I’d like to do this for every room, I may also move this into a reusable sub-flow once all the issues are worked out.
TLDR
Proof of concept of using config button to switch modes.
Regular mode: Switch controls smart lights by direct zigbee binding
Shade mode (activated by double press of config button): Switch has LocalProtection enabled. Switch has a purple led_effect enabled. Pressing up or down on the switch now triggers opening or closing of the shade.
Shade mode is deactivated by double pressing the config button again, at which point the led_effect is cleared and LocalProtection is disabled.