Success with Sonoff zigbee bridge and zigbee binding

socat has no delay, it must come from the zigbee binding, but I have no idea how to fix this

:frowning: the whole zigbee setup is soooo unstable in my OH 2.5 setup. Crashes for no reason from time to time

It seems that crashing was fixed after upgrading OH. 6h+ uptime without crash

Is this feature described somewhere? I only have the options to connect zigbee USB dongles.

Its called “Ember EM35x Coordinator”. Look at the steps in first second post/comment.

FYI, ITead has announced in a video that they will soon sell a Sonoff branded Zigbee 3.0 USB Dongle that is based the exact same Silicon Labs EFR32MG21 SoC as their Sonoff ZBBridge Zigbee Bridge

image

Note! Ember USB Zigbee adapters/dongles/sticks like these are highly recommended over using a remotely connected Ember module using a serial-to-ip bridge / serial forwarding server like ser2net. The reazon for this is that clients using the EZSP serial protocol requires a robust connection between the EmberZNet Zigbee stack running on EFR32 MCU and the serial port of the Zigbee radio. With solutions such as ITEAD Sonoff ZBBridge or a Ser2Net serial proxy connection over a WiFi network it is expected to see NCP entered failed state. Requesting APP controller restart in the logs. This is a normal part of the operation and indicates there was a drop in communication which caused packet loss to occurred between the zigpy radio library and the Zigbee radio. The use of serial network proxies/bridges/servers over WiFi is therefore not recommended when wanting a stable Zigbee environment with Silicon Labs Ember based Zigbee radios. The developers of the bellows radio library for the zigpy project has more information about this if needed.

Quick question; you guys using the Tasmota-flashed Sonoff Zigbee Bridge - do any of you have a working example controlling an RGB light through MQTT (I am interested in the .things definition) ??
I raised the question seperately here: Issue with Sonoff Zigbee Bridge with Tasmota - controlling RGB strip through MQTT - but guess that I might get easier success asking in this thread ?

Can somebody help me? I dont understand how to connect openhab with tasmota.

From what I understood I need to enter the tasmota ip as a port so I tryied like this:

It didn’t worked.
I read on other topics and also on this about serial binding so I created this:


Witch seemed to work, the status changed to online.

But how do I connect the serial binding with the zigbee binding? Or is there something I’m missing here?
I’m using openhab 3.0.1 build.

Thanks!

Your configuration seems correct, since it appears online.
When you use to rfc2217:// (with OH3), you don’t need socat+serial binding anymore.
You should now be able to pair new devices.

I didnt use socat.
So it should work only with the zigbee binding set to rfc2217://… as port?

Yes.
I don’t have OH3 currently running to compare, has anybody else a working setup ?

I tried using the ZigBee Binding like that but could not get it to work at all.
Somewhere on GitHub a ZigBee Binding developer said it should work but it does not.
All in all I was so disappointed that I switched to Z2M.

This is my setup


with rfc2217://172.16.2.32:8888 as port and the rest are default.

This is the log

23:09:03.872 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'zigbee:coordinator_ember:zbBridge' changed from UNKNOWN to OFFLINE: Failed to open communications port
23:09:03.893 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'zigbee:coordinator_ember:zbBridge' changed from OFFLINE: Failed to open communications port to OFFLINE (COMMUNICATION_ERROR)
23:09:08.894 [INFO ] [gbee.handler.ZigBeeCoordinatorHandler] - ZigBee dongle inactivity timer. Reinitializing ZigBee
23:09:08.896 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'zigbee:coordinator_ember:zbBridge' changed from OFFLINE (COMMUNICATION_ERROR) to UNKNOWN
23:09:09.897 [ERROR] [.zigbee.dongle.ember.ZigBeeDongleEzsp] - EZSP Dongle: Unable to open serial port

This is a fresh openhab install on a container.

Switched to openHAB 3.1.0 Build #2177 still not working.

Tryed with socat.

  1. Modified /etc/default/openhab
EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyzbbridge"
  1. Executed
socat -dd pty,link=/dev/ttyzbbridge,raw,user-late=openhab,group-late=dialout tcp:172.16.2.32:8888
  1. Created

And it works.

LATER EDIT:
To start socat as a service at system start you can create /etc/systemd/system/socat-serial.service

[Unit]
Description=Socat zbBridge
Before=openhab.service

[Service]
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=socat-serial

ExecStart=/usr/bin/socat -d -d pty,link=/dev/ttyzbbridge,raw,user-late=openhab,group-late=dialout tcp:1$
Restart=always

[Install]
WantedBy=multi-user.target

Of course you will need to change the ip address.

Then start the service and enable it to start.

systemctl daemon-reload
systemctl start socat-serial
systemctl enable socat-serial

You can check the service status with

systemctl status socat-serial

I tested it on a Debian 10 container running under ProxmoxVE.

Have fun!

Has anyone succeeded with rfc2217 instead of socat ? I’ve tried and failed. Here is the log

2021-02-04 17:32:42.804 [ERROR] [nding.zigbee.serial.ZigBeeSerialPort] - Serial Error: Device cannot be opened on Port rfc2217://192.168.129.132:8888. Caused by Unable to establish remote connection to serial port rfc2217://192.168.129.132:8888
2021-02-04 17:32:42.806 [ERROR] [zigbee.dongle.ember.ZigBeeDongleEzsp] - EZSP Dongle: Unable to open serial port
2021-02-04 17:32:43.816 [INFO ] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee dongle inactivity timer. Reinitializing ZigBee
2021-02-04 17:32:44.930 [ERROR] [nding.zigbee.serial.ZigBeeSerialPort] - Serial Error: Device cannot be opened on Port rfc2217://192.168.129.132:8888. Caused by Unable to establish remote connection to serial port rfc2217://192.168.129.132:8888
2021-02-04 17:32:44.931 [ERROR] [zigbee.dongle.ember.ZigBeeDongleEzsp] - EZSP Dongle: Unable to open serial port
2021-02-04 17:32:49.935 [INFO ] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee dongle inactivity timer. Reinitializing ZigBee

I’m able to open a telnet session with 192.168.129.132:8888

Edit: probably does not work, see #577

I didn’t manage without socat, but your errors seems different then mine.

Serial Error: Device cannot be opened on Port rfc2217://192.168.129.132:8888

Did you tried to telnet to 192.168.129.132:8888? Maybe the port is closed.

image

Yes, I’m able to telnet. There other threads here saying that zwave binding works with rfc2217 but not zigbee. And the issue in githut (by the way, a 8 month old one) says RFC2217 ports cannot be used because there is no discovery logic for these ports

To whom it may apply: I tried to get my zigbee bridge online with OH zigbee binding. Due to not supporting rfc2217 at the moment I configured socat accordingly as a service. Worked fine so far, I was able to open the serial port with a terminal emulator. But within the zigbee binding I received an error message that the port could not be found. Unfortunately no more messages in the OH logs. But I found the problem in syslog. Karaf wasn’t able to write a lock file in /var/lock. /var/lock is owned by root:uucp, so I added uucp group to user openhab and restartet OH: binding online :slightly_smiling_face:
It is because java/karaf opens a lock file when opening a serial port.
My system: ubuntu 20.04 LTS in a linux-container on a qnap nas, OH 3.1.0.M1

Cheers

I am testing this on OH3. Does anyone know difference between Tasmota ZHAbridge and ZbBridge modules? Only ZHAbridge can be connected by socat at 8888 port. Neither other commands mentioned below (like ZbPermitJoin 1) are supported when ZHA current module or Zigbee map otherwise available when ZbBridge current module. Also wonder whether socat --dd command is blocking ‘by-design’ behaviour (it never returns when issued at terminal).

FYI, latest recommendation is to not use WiFi-based gateways like Sonoff ZBBridge as a EZSP bridge.

The reason for this is that EZSP protocol serial interface that OpenHAB (and Zigbee2MQTT as well as HA ZHA) uses does not have good fault tolerance methods for handling packet loss and latency delays.

https://github.com/home-assistant/home-assistant.io/pull/17179

https://github.com/Koenkk/zigbee2mqtt.io/pull/688

I posted a deeper technical explanation and more detailed arguments here:

home-assistant/home-assistant.io#17170

Tip! If still need a network-attached remote EZSP adapter then recommend instead use a (wired) Ethernet-based solution. Examples: