Zigbee and Domoticz

After the installation and configuration for Domoticz with RFLINK and P1 Smartmeter and Bresser Weatherstation hr real home automation started with adding Zigbee devices to the system.

On my wish list were of course light switches and environment sensors like temperature, humidity, presence/movement detection, light (lux).
Now there are many high quality and affordable Zigbee devices on the market, so far so good. A reliable system which gains popularity fast.

Domoticz support for Zigbee devices is not native, it requires plugins and more. The MQTT system has to be used, with an MQTT broker and the Zigbee2MQTT software.
MQTT (Mosquitto is the preferred product on a Raspberry Pi) is the backbone for many home automation solutions, not limited to Zigbee, I may need it for Tasmota integration also.

Zigbee integration has to be done with Zigbee2MQTT, software combined with hardware to access the Zigbee mesh network as Coordinator. Also widely used in home automation, mostly with a Zigbee USB stick as hardware, making it manufacturer independent, no need for limited bridges etc by Zigbee manufacturers as Philips Hue etc.
The list of supported Zigbee devices is limited in Zigbee2Mqtt, but most popular ones are there.

Getting the Zigbee devices into Domoticz uses a plugin called Zigbee2MQTT – Domoticz Python Plugin
The list of supported Zigbee devices is even more limited in Zigbee2Mqtt, a severe limitation!
CHECK THIS LIST FIRST BEFORE BUYING Zigbee hardware. Support of the plugin is one mans evening hobby and therefore slow and limited!
I made the ‘error’ of buying the (quite unique) AduroSmart ERIA smartplug dimmer, supported in Zigbee2Mqtt, but not in Zigbee2MQTT – Domoticz Python Plugin. I made a github issue for support the ‘new device’, but it may take long or never to get support.

Step 1: MQTT Mosquitto

Install following this guideline.
Do also the tests. Note that this installs Mosquitto without much security! Fine for local usage.

Step 2: zzh! CC2652R Multiprotocol RF Stick

I choose the modern zzh! CC2652R Multiprotocol RF Stick, a tiny “USB stick” form-factor development board for multiprotocol RF tinkering! Designed and sold on Tindie by Electrolama in United Kingdom. Easy to add firmware, no special programmer hardware, excellent range.

First step is to add the hardware to a Zigbee network from the Pi. The excellent zzh! CC2652R Multiprotocol RF Stick does the job nicely.

Install the firmware folllowing the Flash Guide and the Coordinator Firmware

First on the Raspberry Pi perform the next command:

ls /dev

and note the ttyUSBx devices. The P1 Smartmeter was ttyUSB0.
Now insert the USB Zigbee stick in the Raspberry Pi (power off and insert the stick, then power on) and do this again:

ls /dev

and note the newly ttyUSBx device, ttyUSB0 ea=nd ttyUSB1, the USB Zigbee stick or the P1 SMartmeter.
If more than one ttyUSBx is attached the Raspberry Pi will randomly give it a sequence number at boot, so ttyUSB0 can become ttyUSB1 and prevent your home system from working.
Therefore find out the id of the port.

ls-l /dev/serial/by-id

and copy the part belonging to the USB stick, for me: usb-1a86_USB_Serial-if00-port0 for the next step.

Step 3: Zigbee2MQTT

Zigbee2MQTT is the toolset required.
With the correct serial port in use identified, edit your Zigbee2mqtt configuration.yaml with that information (scroll down in the editor, the instructions are a bit unclear here!

  port: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

You see the USB Zigbee stick working if you followed the instruction guide to the letter.

Step 4: Zigbee2MQTT – Domoticz Python Plugin

Python plugin for Domoticz to add integration with zigbee2mqtt project. This the part where Domoticz gets the Zigbee devices.

Install following the instructions on the github page and reboot Domoticz (better restart from Domoticz, so you know it works after a reboot!).
In Domoticz you now get an extra tab, called Custom, with Zigbee2MQTT as page and a new Hardware type Zigbee2MQTT. Check the settings, if no security and local MQTT then leave most fields.

(May 11 2021) I had to restore to an older version, before the commits to humidity/temperature/pressure which also broke the WSDCGQ11LM sensors.

git reset --hard b708fc4

Step 5: Add Zigbee devices, pairing

Now power on Zigbee hardware, in a process called pairing. Get the Zigbee device in factory mode, as it is after first ever power on, or pressing buttons. See the docuumentation, every device does it differently.
Allow new hardware on the Settings page “Accept new Hardware Devices Allow for 5 Minutes”
Zigbee devices are entered into Zigbee2MQTT automatically if you check “Allow new zigbee devices to join” on the Domoticz Zigbee2MQTT page, keep that page open!

Refesh and Zigbee hardware will appear in the list. Click in this list on a newly added Zigbee hardware and see the devices you can add to Domoticz devices. This process is really different from native Hardware and Device Domoticz support and not automatic, so look and choose carefully.

From now on it is standard Domoticz, Zigbee devices are available.

(May 11 2021) I had to restore the plugin to an older version before the commits to humidity/temperature/pressure which broke the WSDCGQ11LM sensors.

cd domoticz/plugins/zigbee2mqtt
git reset --hard b708fc4

and restart the system.

Zigbee devices

Philips Hue white A60 bulb E27
Philips Hue Go
Aquara Temperature/Humidity/Pressure sensor
WSDCGQ11LM. Very small, affordable, reasonably correct sensor values.
Replace batteries immediately, one was already empty, the other bad. CR2032 type.
Aqara human body movement and illuminance sensor
RTCGQ11LM. Lux and movement. Small, affordable, reasonably correct sensor values. Temperature (very inaccurate), Lux and movement.

BASICZBR3 Zigbee smart switch
No problems, works fine. Easy to pair, safe to attach wires. Router. Sold for Euro 12,50 at Tinytronics Eindhoven.

Sonoff SNZB-03 – Motion Sensor

CR2450 battery. Small PIR sensor. End device. Performs well.