ZB-GW03 eWeLink Ethernet Zigbee Gateway now hacked with Tasmota and ESPHome so can be used via MQTT or as a remote Zigbee LAN adapter with Home Assistant's ZHA integration or Zigbee2MQTT

Please make sure to use ESPHome 2021.9.3. Can be installed (temporary) by: pip3 install esphome==2021.9.3

1 Like

Thanks, will try that - what are the issues in 2022.2 which 2021.9 does not have? So far (24 hours) no issues.

Am on Hass OS though so no pip. Will try a docker instance instead.

If you see this

  File "/usr/local/lib/python3.9/site-packages/bellows/ezsp/protocol.py", line 138, in __call__
    frame_name = self.COMMANDS_BY_ID[frame_id][0]
KeyError: 520

or these lines

2021-12-31 10:26:01 WARNING (MainThread) [bellows.zigbee.application] Watchdog heartbeat timeout: 
2021-12-31 10:26:16 WARNING (MainThread) [bellows.zigbee.application] Watchdog heartbeat timeout: 
2021-12-31 10:26:31 WARNING (MainThread) [bellows.zigbee.application] Watchdog heartbeat timeout:

at your home-assistant.log you hit this issue: https://github.com/syssi/esphome-zb-gw03/issues/8

Downgrading helps in this case. If you don’t see the issue in the next 7 days it’s probably solved.

1 Like

Technically you don’t need to install Tasmota in HA at all if only use it as a remote Zigbee Coordinator.

Zigbee module UART TX/RX pins ↔ serial stream server ↔ TCP/IP network ↔ socat ↔ ZHA

In this case, Tasmota (or ESHome) is there to act as a serial server to access the serial Zigbee module. The serial server is only a relay/proxy which is used to blindly tunnel raw serial communication data.

That is, as far as ZHA (or Zigbee2MQTT) is concerned it does not know that it is a remote adapter as it only connect to a serial port (via socat) so it does not know or case if it is local or remote serial port.

(Perhaps the most well known serial stream server is the ser2net daemon for Linux).

Because of this, there can be issues with remote Zigbee Coordinator adapters as the serial protocol that they use are not designed to be robust and assume that the connection is always connected and stable.

This is why WiFi connected remote Zigbee Coordinator adapters are not recommended, as if your Wi-Fi network is unstable so it delays or drops packages the serial communication will fail. See comments:

https://www.home-assistant.io/integrations/zha#warning-about-wi-fi-based-zigbee-to-serial-bridgesgateways

Warning! The EZSP protocol requires a stable connection to the serial port. With ITEAD Sonoff ZBBridge connecting over the 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 between ZHA and Sonoff bridge.

https://www.zigbee2mqtt.io/advanced/remote-adapter/connect_to_a_remote_adapter.html

WARNING WiFi-based Serial-to-IP bridges are not recommended as the serial protocol does not have enough fault-tolerance to handle packet loss or latency delays that can normally occur over WiFi connections.

PS: Texas Instruments ZNP serial protocol is however a little more robust than Silicon Labs EZSP.

Eureka, it works.

For other relative new users; use the tip on one of the linked websites (as linked by helpfull idiot) to open 2 tasmota screens: 1 for console, 1 for updating the .ota firmware. I overlooked that tip and apperantly my .ota firmware didn’t work (wrong file signature error) which I didn’t see without the console feedback. I also realized I too quickly closed console screens while it was still loading my backlog inputs. In other words, wait 10s to make sure nothing happens any more after you’ve input a command.

The wrong file signature error had something to do with choosing wrong module (i believe it is 0), but ended up bricking the GW03 messing around choosing the wrong one (no idea I what I was doing at the time).

So I started with a clean slate (needed to unbrick the GW03 anyway) by flashing the GW03 again:

follow the instructions:

Flashing GW03 with most stable firmware (.bin file) as linked by helpfulidiot, created by vahempio, including instructions:

Above link has the ‘ZHA’ fix as referenced by helpfulldiot, but also gives you step by step the right backlogs that correspond with the firmware (I originaly mixed/matches both websites tutorials).

This also includes updating the .ota file. make sure you confirm the firmware is actually updated (I got a fail to see in my second window with tasmota console), but no fault/error given on the firmware update screen

Once that runs, go to the digiblur link to setup (How to use the Sonoff Zigbee Bridge with Home Assistant - Tasmota) to setup zigbee home automation from step #7

2 Likes

Thanks, I stuck with my version for the time being to check stability. Did not come across your mentioned errors in my log.

I am running fw based on your yaml template built on esphome 2022.02 since 23 Feb without HA reboot. No major errors except for the below which did not negatively impact performance/user experience, on average 2-3 times per day (which is much better than the errors caused by the tasmota version):

Logger: homeassistant
Source: util/async_.py:129
First occurred: 23 February 2022, 16:39:29 (19 occurrences)
Last logged: 10:09:04

Error doing job: Exception in callback SerialTransport._call_connection_lost(None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 417, in _call_connection_lost
    self._serial.close()
  File "/usr/local/lib/python3.9/site-packages/serial/urlhandler/protocol_socket.py", line 104, in close
    time.sleep(0.3)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 166, in protected_loop_func
    check_loop(func, strict=strict)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 129, in check_loop
    raise RuntimeError(
RuntimeError: Detected blocking call inside the event loop. This is causing stability issues. Please report issue
$ grep call_connection home-assistant.log
2022-02-27 20:59:09 ERROR (bellows.thread_0) [homeassistant] Error doing job: Exception in callback SerialTransport._call_connection_lost(None)
  File "/srv/homeassistant/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 417, in _call_connection_lost
$ grep call_connection home-assistant.log.1 
2022-02-25 22:59:35 ERROR (bellows.thread_0) [homeassistant] Error doing job: Exception in callback SerialTransport._call_connection_lost(None)
  File "/srv/homeassistant/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 417, in _call_connection_lost
$

I can find the same errors (just less often) in my log. The uptime (esphome sensor) of my device is around 23 days. Conclusion: The device doesn’t crash. Just the network connection drops every now and then. In my case the setup is able to recover and doesn’t require any manual restarts.

Back on this channel again. After +/- 2 weeks of having fun with the GW03 and tasmota firmware, it seems to be very unstable. (I now even struggle to get the GW03 back online, even starting from scratch again. Flashing works, but the ‘fixed Ecroc file’ doesn’t allow me to connect through 192.168.4.1), the helpfull idiot flash file does, but is very unstable in my setup.

In other words, the ESPhome route then, but I get stuck (as always due lack of full understanding what I am doing).

-I work with W10, CMD so therefore:

-I installed python (3.10) with GIT and I have installed ESP home 2021.9.3
-I have check working order by command ‘Esphome version’ and replies with: “version 2021.9.3”

-I have created a folder on my desktop called MyEsphome
-I have opened this folder in CMD, so my line states: C:\Users\Seesar\Desktop\MyEsphome
-now the guide states: " Setup an ESPHome Project (see README.md), compile the firmware for the gateway and flash the firmware to the device:"

No idea what this means…

-I managed to create a project by running the wizard (ESPhome wizard gw03.yaml) and followed the 4 steps (esp32, board esp-wrover-kit, SSID + PW and test OTA pw). A file is created called gw03.yaml in folder myesphome. This yaml files then contains my SSID and pw etc information.

My questions is, how do I compile the rest of the firmware and flash it with the configuration file?

I managed to flash the GW03 by running the command ‘Esphome run coordinator-example.yaml’.

As part of trail and error (because no idea what above instruction means) I created this file by manually creating a text file, copy-pased the example data in it an called it ‘coordinator-example.yaml’; there is no download option.

This file is successfully compiled and uploaded to the GW03, but of course it then still doesn’t know what my SSID and PW is to connect to the network; hence it is not recognized either.

So in short, what step am I missing, or what am I doing wrong?

I am not sure how the 2 files:

-coordinator-example.yaml
-wizard created gw03.yaml for SSID info

work together/are compiled/flashed together.

Also from where does it get configured to be in ethernet mode instead of wifi?

hey i´ve bought this ethernet Gateway click gut i don´t know how i can integrate this, i know the ip adress and the port from my router but it was all.

can anybody help me please ?

Thanks a lot and greetings from germany

That is not the same as the ZB-GW03 so off-topic for this thread, please create a new seperate topic thread instead.

I use ZB-GW03 flashed with Tasmota (tasmota32-EWELINK_11.1.0) and ncp-uart-sw_6.7.8_115200.ota
It works with zigbee2mqtt. I have 5 devices connected, and all of them are routers. After z2m restart, all devices are online for about 2-3 hours, sending updates each several minutes. And then all devices go offline altogether.
Do you have any ideas about how to debug and find the reason for such unpleasant behaviour?
This is an example of logs of a device online and then offline

Zigbee2MQTT:info  2022-12-13 13:29:47: MQTT publish: topic 'zigbee2mqtt/DIN1 switch', payload '{"ac_frequency":50.02,"current":1.424,"energy":504.38,"last_seen":"2022-12-13T13:29:47+00:00","linkquality":204,"power":86,"power_factor":24.9,"produced_energy":0,"state":"ON","voltage":241.1}'
Zigbee2MQTT:warn  2022-12-13 13:39:52: Failed to ping 'DIN1 switch' (attempt 1/2, Read 0x84b4dbfffeb8a8f7/1 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":true,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (sendZclFrameToEndpointInternal error))
Zigbee2MQTT:warn  2022-12-13 13:39:55: Failed to ping 'DIN1 switch' (attempt 2/2, Read 0x84b4dbfffeb8a8f7/1 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (sendZclFrameToEndpointInternal error))
Zigbee2MQTT:info  2022-12-13 13:39:58: MQTT publish: topic 'zigbee2mqtt/DIN1 switch/availability', payload '{"state":"offline"}' 

I am trying to get the device working as a router wit Esp home.
After a lot of puzzling i got the device in Esp home and added it to home assistant.
I have 4 entities so that is goed.
I can telnet in to the device but i am stuck at pont 7 of the installation instructions for the router.
I also could not get the transfer tool LRZSZ installed, but it looks like it is running fine without that.

7. Go to a second terminal and upload the new firmware. You don't need to cancel the telnet session
$ sx -vv -X -b --tcp-client 192.168.132.230:6638 efr32mg21_zigbee_router_signed-6.7.10.gbl.ota

If I open another window with cmd and paste the command in there I get the error that $ isn’t recognized as an internal command.
I tried a telnet session with putty but that seems to hang right on connecting, I can’t enter any command. Could someone please help me get this thing running as an router? My goal is to put this in the garage and send the ZigBee messages over ethernet to my home. as most know the wireless options do not work properly(I have tried 2)

Did you succeed or do you like some guidance?

I gave up on this. I went another route. And added a repeater to get good zigbee signal in my garage.

Hi all,
A simple question:I flashed my esphome-zb-gw03 in router mode with the very nice tuto(esphome-zb-gw03/router.md at 498a2dff57e2657b5e81f5e5349aa463d7912de5 · syssi/esphome-zb-gw03 · GitHub), and unfortunately, the pairing step doesn’t work. I start the pairing mode and I try to get the ESP with zigbee2MQTT but nothing…
Any ideas?

François

1 Like

We have built tasmota firmware in all languages based on ZB-GW03. The ETH version has wifi turned off by default, and it can be used after power-on without configuring the template. If you need to check the IP address, you can use the mdns tool to scan the network to find tasmota’s gateway, and you can also log in to the background of your router to check the gateway’s IP address. If the ETH version does not meet your needs, you can also use the WIFI&ETH version without additional configuration.

2 Likes

Good day,

First of all sorry if my questions seem very simple, I´m very new in this tasmota world.
I have bought a ZB-GW03 device that comes with tasmota preinstalled. Really this is my second one because I bricked the first one on the first day.
I have plugged and connected it to my network thru ethernet and I have one Hue light already linked. My problem is that I cannot connect it to Home Assistant in anyway.

I have MQTT installed and configured in the zb-qw03 hub, no problem here, but when I try to connect Zigbee2Mqtt it doesn’t work. I only was able to connect it when I change GPIO 3 and 5 from ZigBee TX and RX to TCP Rx and RXthe Template and started the TCP in port 8888, but at this moment I cannot access the light thru the hub (I connect with it sending commands from the console), and also no device appears in the Z2M device list, neither the coordinator.

This is my Zigbee2MQTT configuration.

Socat:

enabled: false
master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
options: “-d -d”
log: false

mqtt:

server: mqtt://192.168.0.50:1883
username: XXXX
password: XXXX

serial:

port: tcp://192.168.0.60:8888
adapter: ezsp

Please, someone who gives me a way to follow, I wouldn’t like to brick another one checking by myself.

Many thanks in advance.

Not sure if it is you or me that is confused now. Can you clarify your setup with a diagram or something?

Is it that you want the ZB-GW03 as a remote Zigbee Coordinator for Zigbee2MQTT? Or do you want to use the native Zigbee2Tasmota (Z2T) Zigbee gateway and control its devices via MQTT. You can do either one of those but not both as both of those features are mutually exclusive.

You need to understand that Zigbee module inside the ZB-GW03 is a only serial radio device and as such the Zigbee module can only be used by one single Zigbee gateway solution, (e.i. you can not connect two Zigbee gateway solutions to it), and it sounds as if you have already enabled the native Zigbee2Tasmota (Z2T) Zigbee gateway, which means that you can not also connect a different Zigbee gateway solution like Zigbee2MQTT or ZHA.

If you wanted to ZB-GW03 as a remote Zigbee Coordinator for Zigbee2MQTT or ZHA then you need to disable the native Zigbee2Tasmota (Z2T) Zigbee gateway and instead enable the serial server (e.i. the Serial to TCP Bridge that will allow serial protocol over TCP/IP pass-through) which will allow you to tunnel the serial communication from the Zigbee SoC inside the ZB-GW03 is a serial device to Zigbee2MQTT or ZHA via a socket. See → https://tasmota.github.io/docs/Serial-to-TCP-Bridge/

Also, Zigbee2MQTT is not a MQTT server (also known as a MQTT broker), but instead Zigbee2MQTT
is just MQTT client, so it can not connect to other MQTT clients like the native Zigbee2Tasmota (Z2T) Zigbee gateway.

Here are a few links to some guides about ZB-GW03 and Sonoff ZBBridge which might help you:

Hi Hedda, good day,

I’m the confused one, for sure.
Reading your post I understand that, when I receive the ZB-Gw03 it already arrives with Tasmota and a native configuration of Zigbee2Tasmota that should be an internal device soft that allows Tasmota to communicate with the zigbee antenna.
As long as I can read these days, use the coodinator via Z2T is not easy for non inizied ussers so I want the ZB-GW03 as a remote Zigbee Coordinator for Zigbee2MQTT as I like to think that it would be the easier way to manage the zigbee devices, maybe I’m wrong. I have also a Mosquitto MQTT broker installed in my HA and running.

Presently I have a HA OS running in a virtual box machine over Mac OS with a Mosquitto broker, I have installed the zb-gw03 connected directly to my router, closer to where I will have almost all of my zigbee devices.

I will read detailed the links that you have referenced in your post about disabling the Zigbee2Tasmota and the installation of ser2net, but any help will always be welcomed.
Edited: Ser2Net seems that must be used when you have a coordinator installed in another machine, than is not the case, it is its own machine.

Many thanks for your time and interest!

Well, I think that I’m still a bit confused.
I would like to use the zb-gw03 as a zigbee ethernet coordinator for zigbee2mqtt, seems that Z2M would be the easier way for me to integrate devices later (I needed a couple of hours to switch on/Off my light from Node-Red)
Understood that, as I have preinstalled Zigbee2Tasmota I must disable it before starting other configurations, but I cannot find the way. I have tried reassigning GPIOs 2 & 4 from ZBTX & ZBRX to TCP TX & TCPRX and starting TCP service in Port 8888 latter, it let me connect Zigbee2MQTT to the hub but it doesn’t receive any info, neither from the hub itself. Is there any command that I have to RUN to disable ZIgbee2Tasmota in the HUB? I cannot find it in the documentation.

Another way that I could try would be installing ESPhome firmware by Syssi, but I have not clear if it has any issue with the 2023.5.1 version of ESPHome that I have installed, and I’m not sure to downgrade it without harming two devices that I already have connected.

Sorry for another crying brick.

Regards from Huelva.