My system is openHAB 2.5.10-1 running on a Raspberry Pi 4B Rev 1.2. Here I have succesfully setup an MQTT broker with the addon MQTT Binding 2.5.10.
I’m running zigbee2mqtt with a CC2531 as coordinator and at the moment I have mainly connected lights and light controls to the system. All bindings are fine and I’ve set it up with attribute_and_json output.
Everything in openHAB is setup with Paper UI.
I’ll give one example of a light thing I’ve added, it’s the same for all other lights:
I added a generic MQTT thing and called it Livingroom light. It has two channels:
mqtt:topic:559d2185:Livingroom_dim
Channel type: Percentage Value
State topic: zigbee2mqtt/Livingroom_Light/brightness
Command topic: zigbee2mqtt/Livingroom_Light/set/brightness
Absolute minimum: 0
Absolute maximum: 254
Is command
mqtt:topic:559d2185:Livingroom_On_Off
Channel type: On/Off Switch
State topic: zigbee2mqtt/Livingroom_Light/state
Command topic: zigbee2mqtt/Livingroom_Light/set
Is command
These are linked to items:
Livingroom_Dimmer
Livingroom_On_Off
These items work like the should, either in control in the Paper UI or when added to a HABPanel or when I use a widget on my phone.
I have a remote control with 4 groups that I have bound and added as a Thing with 6 channels:
mqtt:topic:cc7a40cd:Robb1_Battery
Channel type: Number Value
State topic: zigbee2mqtt/0xccccccfffe6459c8/battery
Is command
mqtt:topic:cc7a40cd:Robb1_Link_Quality
Channel type: Number Value
State topic: zigbee2mqtt/0xccccccfffe6459c8/linkquality
Is command
mqtt:topic:cc7a40cd:Robb1_Action
Channel type: String (text)
State topic: zigbee2mqtt/0xccccccfffe6459c8/action
Is command
mqtt:topic:cc7a40cd:Robb1_Action_Group
Channel type: Number Value
State topic: zigbee2mqtt/0xccccccfffe6459c8/action_group
Is command
mqtt:topic:cc7a40cd:Robb1_Click
Channel type: String (text)
State topic: zigbee2mqtt/0xccccccfffe6459c8/click
Is command
mqtt:topic:cc7a40cd:Robb1_Action_Rate
Channel type: Number Value
State topic: zigbee2mqtt/0xccccccfffe6459c8/action_rate
Is command
All linked to their own items, where I can see the correct values coming through. I want to use the action item to trigger some rules. This item is Robb1_Action.
On and Off is very simple (this will display as on_1/off_1 for group 1, on_2/off_2 for group 2 etc.).
I’m struggling with setting a rule for the dimmer. When I keep the on button for group 1 pressed, it will give the action “brightness_move_up_1” and when I release it will say “brightness_stop_1”. For the off button it is “brightness_move_down_1” and also “brightness_stop_1”.
How can I set a rule that will slowly dim the light (for example -1% every 200 ms) as long as the command is “brightness_move_down_1” until it gets the command “brightness_stop_1”, and of course the same for move up.
I’ve looked around on this forum and tried several examples, but it won’t work like I want to. I did get it working that a long press would dim it one step, but not that it would keep dimming until I released this button.
Could anyone help me to setup this rule?