openHAB and zigbee2mqtt Tutorial for Beginners

Thanks for the tutorial. It’s almost all working on OH2.1, but I only seem to be able to send commands to Zigbee2MQTT and don’t get any feedback, so don’t see link quality for example.

Would anyone have any ideas? I have paired a simple SA-003-Zigbee switch with the following things and items. JSONPATH has also been installed.


Bridge mqtt:broker:mosquitto [ host="localhost", port=1883, secure=false ]

    Thing topic switchLoungeAmp  "Lounge Amplifer" @ "Office" {
        Type switch : state       "state" 		[ stateTopic="zigbee2mqtt/switchLoungeAmp", commandTopic="zigbee2mqtt/switchLoungeAmp/set", transformationPattern="JSONPATH:$.state", on="ON", off="OFF" ]
		Type number : linkquality "linkquality" [ stateTopic="zigbee2mqtt/switchLoungeAmp", transformationPattern="JSONPATH:$.linkquality", unit="lqi" ]            



Switch	ZigbeeLoungeAmplifer 		   "Lounge Amplifer Power [%s]" { channel="mqtt:topic:mosquitto:switchLoungeAmp:state" }
Number	ZigbeeLoungeAmpliferLinkquality "Lounge Amplifer LQ [%s]"    { channel="mqtt:topic:mosquitto:switchLoungeAmp:linkquality" }

I don’t think this is a valid unit.

Can you show the JSON published to zigbee2mqtt/switchLoungeAmp by your Zigbee device?

Thanks @hafniumzinc, have removed the unit and it still loads the things file but unfortunately same issue.

Bit new to this, but think the JSON is { “linkquality”: 26, “state”: “ON” } I got this from MQTT explorer.

Good news, it’s now working. Not sure why, reboot fixed it :grinning_face_with_smiling_eyes:

Now to get my TRVs working!

openHAB has a problem with Things files, not always updating after a save. You can restart openHAB, but I do this.

1 Like

Hello together,

how can i create an item with transition? At the moment i created a dummy item and a rule with an command like this:
SchlafzimmerTVLampeControl.sendCommand("{“brightness”:0, “transition”:30}")
Is there another way to set this both values into an item with OH3???


can this be applied to Openhab v. 3.1.0, I’ve found that the available binding is

But cannot understand how to implement options that are availables in the xml of device in openhab.

Would zigbee2mqtt not conflict with zigbee binding?

Thanks, BR

Hello, I haven’t tested this on OH3.1.0 but this topic is quite popular and I haven’t received any feedback that it doesn’t work. However, I think there is a basic misunderstanding.

If you use zigbee2mqtt, then oH does not ‘see’ zigbee, but sees mqtt. So you actually need the mqtt binding, and a coordinator that is supported by zigbee2mqtt, see their documentation for more details.

If you want to work with zigbee in OH directly, then you would use the zigbee binding, and an off the shelf coordinator like the one from Ikea.

You are correct, and just to add on your comment:

  1. You can use zigbee2mqtt (with a USB coordinator that is supported) and mqtt - OH then connects to mqtt (via the mqtt binding) and not directly to zigbee

  2. You can use OH’s zigbee binding with a zigbee hub (?) and also a USB coordinator that is supported - in this case OH directly connects to zigbee without mqtt

(1) is what this thread is about.

Thank you for the informations, just bought the wrong adapter, it works fine with OH’s zigbee binding, but it isn’t supported by zigbee2mqtt.

Thanks, BR

Note that there is no “off the shelf coordinator like the one from Ikea” compatible with OH’s zigbee-binding as it is a native Zigbee implementation meaning it does not support so-called Zigbee hubs/bridges/gateways. If you use Zigbee hubs/bridges/gateways like IKEA’s Trådfri Gateway or Philips Hue Bridge then they offer an API with different protocols similar to how Zigbee2MQTT offers MQTT instead of Zigbee, and niether of those are supported by OH’s zigbee-binding.

OH’s zigbee-binding only support serial protocols over serial interfaces so you need to use a USB-adapter (with USB-to-UART converter) or a GPIO UART adapter which is presented to the application as a serial device by the operatingsystem.

OH’s zigbee-binding is based Z-Smart Systems ZigBee Cluster Library Java framework supporting multiple dongles on currently compatible with a few different Zigbee stacks and protocol versions; “CC2531” TI ZNP serial API from Z-Stack 1.2 (note that it does not yet support newer Z-Stack 3.x like Zigbee2MQTT does), “Ember” = Silabs EZSP (EmberZNet Serial Protocol) up to v8, Telegesis Zigbee AT protocol, Digi XBee-PRO Zigbee.

As noted above, you can not use OH’s zigbee-binding with a Zigbee hub, (a Zigbee hub like IKEA’s Trådfri Gateway or Philips Hue Bridge does not offer a Zigbee API but translate to different protocols), at least not unless you have hacked that hub and can instead install a Serial-to-IP server proxy that can pass along the serial interface from the Zigbee radio microcontroller module to the zigbee-binding using something like ser2net and socat. In that case the zigbee-binding sees it just like a local Zigbee coordinator that it can talk to via its serial protocol even though it can actually located somewhere else on your LAN. But if you decide to do so then make sure it has as wired Ethernet and not WiFi as serial communication is not stable over Serial-to-IP if use WiFi. One hardware that could in theory be hacked to do so is ZB-GW03 eWeLink Ethernet Zigbee Gateway:

Hacking ITead’s Sonoff ZBBridge to use with Serial-to-IP with OH’s zigbee-binding is strongly not recommended because it uses WiFi which is not stable enough for the EmberZNet Serial Protocol.

Regardless of adapter, it is recommended to use USB extension cables with USB adapters and keep any Zigbee coordinator away from any electromagentic interferance, specially Wi-Fi access-points/routers.

Tip if you want to use Zigbee2MQTT is to checkout ITead Sonoff Zigbee 3.0 USB Dongle Plus based on Texas Instruments CC2652P (however note Z-Stack 3.x is not yet compatible with OH’s zigbee-binding):

Tip if you want to use OH’s zigbee-binding instead is to use a Silicon Labs based ERF32 based “Ember” (EZSP = EmberZNet Serial Protocol) adapter, preferably based on Silabs EFR32MG12 or EFR32MG21. Unfortunately, there is not much choice on the marked there today other than ELElabs ELU013 which is based on EFR32MG12 and also sold as Popp ZB-STICK 701554

Alternatively if you want an inexpensive EFR32MG21 adapter and are willing to modify then check out:

Note that Silicon Labs EFR32 / EZSP based apter only have very early initial experimental support in Zigbee2MQTT and is not recommended to anyone other than developers of zigbee-herdsman.

1 Like