SonOFF button SNZB-01P has short, long, double press, but binding shows only single press

  • openHABian 3.4.3 on rPi4 with 4GB

I have a SonOFF Zigbee button withe three ways to press the button: single, double, and long.

However, it seems the binding can only detect the single press.

There is also only one ON|OFF channel available in the thing.

Is this a Zigbee binding issue or something I could fix?

E.g., I saw this post, but can neither make sense of the code, nor would I know if this achieves the desired outcome.

I did a TRACE for all three button presses. The double press resulted in a OnCommand rather then a ToggleCommand like the other presses.

# on
2023-08-19 08:31:56.760 [TRACE] [com.zsmartsystems.zigbee.ZigBeeNode ] - 84BA20FFFEDC2D60: ZigBeeNode.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=01])
2023-08-19 08:31:56.761 [TRACE] [.zsmartsystems.zigbee.ZigBeeEndpoint] - 84BA20FFFEDC2D60: Endpoint 1. ZigBeeEndpoint.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=01])
2023-08-19 08:31:56.761 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.handleCommand(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=01])
2023-08-19 08:31:56.762 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener org.openhab.binding.zigbee.internal.converter.ZigBeeConverterSwitchOnoff@1d6996a of ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=01]
2023-08-19 08:31:56.774 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener LATCH Done - true
2023-08-19 08:31:56.856 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: DefaultResponse [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=07, commandIdentifier=1, statusCode=SUCCESS] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=92, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=01, commandIdentifier=2, statusCode=SUCCESS]]

# off
2023-08-19 08:31:59.746 [TRACE] [com.zsmartsystems.zigbee.ZigBeeNode ] - 84BA20FFFEDC2D60: ZigBeeNode.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=02])
2023-08-19 08:31:59.747 [TRACE] [.zsmartsystems.zigbee.ZigBeeEndpoint] - 84BA20FFFEDC2D60: Endpoint 1. ZigBeeEndpoint.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=02])
2023-08-19 08:31:59.747 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.handleCommand(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=02])
2023-08-19 08:31:59.748 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener org.openhab.binding.zigbee.internal.converter.ZigBeeConverterSwitchOnoff@1d6996a of ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=02]
2023-08-19 08:31:59.755 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener LATCH Done - true
2023-08-19 08:31:59.812 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: DefaultResponse [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=08, commandIdentifier=0, statusCode=SUCCESS] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=63, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=02, commandIdentifier=2, statusCode=SUCCESS]]

# long on
2023-08-19 08:32:04.086 [TRACE] [com.zsmartsystems.zigbee.ZigBeeNode ] - 84BA20FFFEDC2D60: ZigBeeNode.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=03])
2023-08-19 08:32:04.087 [TRACE] [.zsmartsystems.zigbee.ZigBeeEndpoint] - 84BA20FFFEDC2D60: Endpoint 1. ZigBeeEndpoint.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=03])
2023-08-19 08:32:04.088 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.handleCommand(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=03])
2023-08-19 08:32:04.089 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener org.openhab.binding.zigbee.internal.converter.ZigBeeConverterSwitchOnoff@1d6996a of ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=03]
2023-08-19 08:32:04.097 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener LATCH Done - true
2023-08-19 08:32:04.155 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: DefaultResponse [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=09, commandIdentifier=1, statusCode=SUCCESS] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=64, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=03, commandIdentifier=2, statusCode=SUCCESS]]

# off
2023-08-19 08:32:07.575 [TRACE] [com.zsmartsystems.zigbee.ZigBeeNode ] - 84BA20FFFEDC2D60: ZigBeeNode.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=04])
2023-08-19 08:32:07.576 [TRACE] [.zsmartsystems.zigbee.ZigBeeEndpoint] - 84BA20FFFEDC2D60: Endpoint 1. ZigBeeEndpoint.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=04])
2023-08-19 08:32:07.576 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.handleCommand(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=04])
2023-08-19 08:32:07.577 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener org.openhab.binding.zigbee.internal.converter.ZigBeeConverterSwitchOnoff@1d6996a of ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=04]
2023-08-19 08:32:07.587 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener LATCH Done - true
2023-08-19 08:32:07.643 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: DefaultResponse [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=0A, commandIdentifier=0, statusCode=SUCCESS] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=65, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=04, commandIdentifier=2, statusCode=SUCCESS]]
2023-08-19 08:32:07.696 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: ReportAttributesCommand [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=61, reports=[AttributeReport [attributeDataType=BOOLEAN, attributeIdentifier=0, attributeValue=false]]] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=118, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=04, commandIdentifier=2, statusCode=SUCCESS]]

# double on
2023-08-19 08:32:10.489 [TRACE] [com.zsmartsystems.zigbee.ZigBeeNode ] - 84BA20FFFEDC2D60: ZigBeeNode.commandReceived(OnCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=05])
2023-08-19 08:32:10.490 [TRACE] [.zsmartsystems.zigbee.ZigBeeEndpoint] - 84BA20FFFEDC2D60: Endpoint 1. ZigBeeEndpoint.commandReceived(OnCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=05])
2023-08-19 08:32:10.491 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.handleCommand(OnCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=05])
2023-08-19 08:32:10.491 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener org.openhab.binding.zigbee.internal.converter.ZigBeeConverterSwitchOnoff@1d6996a of OnCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=05]
2023-08-19 08:32:10.499 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener LATCH Done - true
2023-08-19 08:32:10.556 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: DefaultResponse [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=0B, commandIdentifier=1, statusCode=SUCCESS] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=64, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=05, commandIdentifier=1, statusCode=SUCCESS]]

# off
2023-08-19 08:32:13.118 [TRACE] [com.zsmartsystems.zigbee.ZigBeeNode ] - 84BA20FFFEDC2D60: ZigBeeNode.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=06])
2023-08-19 08:32:13.119 [TRACE] [.zsmartsystems.zigbee.ZigBeeEndpoint] - 84BA20FFFEDC2D60: Endpoint 1. ZigBeeEndpoint.commandReceived(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=06])
2023-08-19 08:32:13.119 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.handleCommand(ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=06])
2023-08-19 08:32:13.120 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener org.openhab.binding.zigbee.internal.converter.ZigBeeConverterSwitchOnoff@1d6996a of ToggleCommand [On/Off: C0A7/1 -> 0000/1, cluster=0006, TID=06]
2023-08-19 08:32:13.130 [TRACE] [.zsmartsystems.zigbee.zcl.ZclCluster] - C0A7/1: ZclCluster.notifyCommandListener LATCH Done - true
2023-08-19 08:32:13.189 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: DefaultResponse [On/Off: 26A9/1 -> 0000/1, cluster=0006, TID=0C, commandIdentifier=0, statusCode=SUCCESS] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=68, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=06, commandIdentifier=2, statusCode=SUCCESS]]
2023-08-19 08:32:13.237 [TRACE] [transaction.ZigBeeTransactionManager] - notifyTransactionCommand: ReportAttributesCommand [Electrical Measurement: 4E37/1 -> 0000/1, cluster=0B04, TID=E4, reports=[AttributeReport [attributeDataType=UNSIGNED_16_BIT_INTEGER, attributeIdentifier=1288, attributeValue=3936]]] ZigBeeTransaction [ieeeAddress=84BA20FFFEDC2D60 queueTime=115, state=DISPATCHED, sendCnt=1, command=DefaultResponse [On/Off: 0000/0 -> C0A7/1, cluster=0006, TID=06, commandIdentifier=2, statusCode=SUCCESS]]

I reckon if the binding does not do the translation of the button commands, I won’t see them in the log either :slight_smile:

Any hints appreciated.

I have one of those devices.

If you subscript to the MQTT topic what do you see?

I am using zigbee2mqtt and mosquitto and I used the command below to check what is being sent to MQTT.

mosquitto_sub -h 192.168.1.164 -v -t "zigbee2mqtt/switch-aircon-west/#"

zigbee2mqtt/switch-aircon-west {"action":"single","battery":100,"last_seen":"2023-08-19T13:46:48+10:00","linkquality":32,"voltage":3000}
zigbee2mqtt/switch-aircon-west/availability online
zigbee2mqtt/switch-aircon-west {"action":"long","battery":100,"last_seen":"2023-08-19T13:46:36+10:00","linkquality":36,"voltage":3000}
zigbee2mqtt/switch-aircon-west {"action":"double","battery":100,"last_seen":"2023-08-19T13:46:42+10:00","linkquality":40,"voltage":3000}

You can see the action: part is single, long and double.

I have set up a channel for on and off using single press for ON and long press for OFF.

And I use a transformation to get the action data. (I have regex transformation installed as well)
If you press the Show advanced tick box top right hand corner you will see the Incoming Value Transformations field.

I have this in that field: REGEX:(.action.)∩JSONPATH:$.action

Don’t know if that helps but may give you some clues.

1 Like

Thanks… looks like I have to go down this route…

…after I figure out if there is an issue using both the Zigbee and zigbee2mqtt binding.

I reckon a device should only be registered with one binding?!

Do I need a second Zigbee dongle?
One for each binding?

Just figured out that zigbee2mqtt is a different system altogether; hence, yes, a second coordinator is required. :slight_smile:
I think I have one lying around somewhere.

You should be able to use the Zigbee co-oordinator you already have.
I have never used the Zigbee binding but it should be similar in the way the button presses get seen and acted upon?
I just use MQTT for pretty much everything.
zigbee2mqtt also has a great web interface.

and this

Well, I have (eventually) received the sonoff Zigbee dongle; set up zigbee2mqtt, and paired a new button. So far so good.

I have created a thing in OH, and added relevant channels.

Back to the switch, and my post title… I wanted to use the three distinct action commands from the switch, to use these actions for different outcomes / commands. E.g. short for toggle on/off; long for dim up down, double for something else (I haven’t figured yet).

Is this even possible? (edit: I reckon I need to add a rule)

If not, then the binding is more elegant, to understand the short press as toggle.


Why do you need the transformation?


If I summarise the idea of using zigbee2mqtt, I have to do all the same steps in OH, as I would with the Zigbee binding; create a thing, its channels, and point it to the MQTT msg from zigbee2mqtt.

Of you read back though this post you will see a screenshot I did and it has the single and long press for on and off.
You can do a rule for when that does the tie of button press you want.

The zigbee2mqtt can use your current broker it’s a setting in the configuration file.

Thanks… the problem has been solved here:slight_smile: