Introduction

When building a smart home system, the Zigbee network plays a central role, enabling seamless communication between various smart devices. For users seeking open-source smart home solutions, ZBDongle-E is an ideal choice for connecting Zigbee devices to Home Assistant or Zigbee2MQTT.

This article will guide you through the process of installing Ser2net on an OpenWRT router to liberate ZBDongle-E from the constraints of direct USB connection to the host, allowing ZBDongle-E to operate within the network and manage your Zigbee devices more efficiently.

Required Equipment and Tools

  • OpenWRT Router (must have a USB port, this article uses the Xiaomi Router Mini, the second-hand price is about $3.3)
  • SONOFF ZBDongle-E (with CP2102 serial chip)
  • Necessary Computer or Terminal Device
  • Putty (not necessary)

Step 1: Install OpenWRT

Before you begin, ensure your router is compatible with OpenWRT by checking the OpenWRT official support list: OpenWRT Hardware Compatibility.

It is recommended to use the latest stable version 23.5.5 firmware, which you can download from the OpenWRT official website: OpenWRT Firmware Downloads.

The methods for flashing firmware vary across different routers. There are already a plethora of tutorials on how to flash OpenWRT online; please search on Google yourself.

Step 2: Install Software and Drivers

You will need to install the following on your OpenWRT:

  • ser2net: Ser2net is an open-source software that allows bidirectional transparency between TCP/IP or UDP data and serial port data. In simpler terms, Ser2net can forward network data to a serial port and vice versa, bridging the network and serial port.
  • luci-app-ser2net: A visual configuration application for Ser2net
  • kmod-usb-serial-cp210x: CP2102 serial port chip driver

Note: kmod-usb-serial-cp210x is only suitable for ZBDongle-E(SONOFF Zigbee 3.0 USB Dongle Plus v2) and ZBDongle-P(SONOFF Zigbee 3.0 USB Dongle Plus) devices with a CP2102 serial port chip.

How to install software via OpenWRT

Update the list through the software marketplace and search for installations

Step 3: Configure ZBDongle-E

  1. Plug ZBDongle-E into the USB port of the OpenWRT router (an extension cable is recommended if available).
  2. If the router has only one USB port, the default serial port path is: /dev/ttyUSB0
  3. If you are unsure, have multiple USB ports, or cannot connect after configuration, you can use terminal tools like Putty to SSH into the OpenWRT router and enter the command:
dmesg | grep tty

Step 4: Configure Ser2net

  1. Go to the router management background through a browser, and then enter the ser2net configuration page
  2. In the Default settings, set the relevant information for ZBDongle-E, mainly Baud rate: 115200.
  1. Navigate to the proxies settings page, configure the protocol as RAW, and set the device’s serial port path, which in this article is: /dev/ttyUSB0. Save the configuration after completion.

Step 5: Add Network Coordinator to Open Source Platforms

Home Assistant ( Version:13.2 )

Enter the router IP and the port configured in Ser2net, for example: tcp://192.168.1.1:5000.

If the recognition is successful, it prompts whether you want to restore the network.

Once the recovery was complete, we connected to a ZBDongle-E network coordinator.

Zigbee2MQTT ( Version: 1.41.0-1 )

Modify the serial port information to:

Serial?
port: tcp://192.168.1.1:5000
adapter: ezsp

The setup is complete, start Zigbee2MQTT, and you’re done!

Troubleshooting and Optimization

1. Are you encountering errors when configuring ZBdongle-E with Home Assistant (HA) or Zigbee2MQTT (Z2M)?

Solution 1:

Check the network environment to check whether the gateway address of the router connected to ZBDongle-E can be accessed by the host.

Solution 2:

Uninstall ser2net, luci-app-ser2net, kmod-usb-serial-cp210x software on the OpenWRT router, then reinstall and configure;

Solution 3:

Restore the factory configuration of your OpenWRT router and restart the configuration.

2. How do I determine if the device is properly recognized by the OpenWRT router?

Solution:

Using a terminal tool such as putty, log in to the OpenWRT router, and enter

ls /dev/tty*

Check whether there is /dev/ttyUSB0 or /dev/ttyUSB1, if so, it means that the device has been successfully connected and the driver is working normally.

Conclusion

By turning ZBDongle-E into a Zigbee network coordinator, you can place the Zigbee coordinator and home router together in the center of your home, allowing the host to be placed in concealed locations such as the basement or attic, satisfying more usage scenarios. Some people create HA clusters through Proxmox, and the ZBDongle-E, now a network coordinator, is accessed via the router IP, which is less likely to change, allowing for quick recovery of the Zigbee network.