
3.7. Double Momentary Switch (Push Buttons) as Dimmer Switch
Related C++ class: CZigBeeDeviceSetupInputPatternDoublePushLevel.
This is a more complex recipe designed for dimming a light, or generally speaking adjusting the level
(intensity, speed, brightness, …) of a level controllable output utilizing two momentary switches (push
buttons, one stable position). Users are able to turn a light on with a short press on one button (e.g.
left button of a double switch), i.e. tapping the button for less than a second; and also dim up with a
long press on the same button, i.e. keeping the button pressed for more than a second; the second
button is used for the opposite actions, i.e. a short press on the second (e.g. right button of a double
switch) will turn the lights off; a long press on this button will dim the lights down.
The idea is that each transition from the pressed state to the released state fires an “on” command for
the first button (“off” command for the second button), and each transition from the pressed to the
kept-pressed state fires a “move with on/off” command, where the direction is “up” for the first button
(“down” for the second button). Notice that the command templates for moving also contain a
configurable move rate. Finally, a transition from the kept-pressed to the released state fires a “stop”
command (same for both buttons).
3.7.1. Examples
The following example shows the input action micro-code for using two push-buttons to control a
target dimmer (whether it be the local output or a remote device) in an up/down manner, i.e. one
button is used to turn the light(s) on and dim brighter, the other one to turn the light(s) off and dim
darker:
12