A Wired Sonoff Zigbee Alternative

UPDATE 10/15: READ IF YOU PLAN TO USE HUB WITH ZHA

UPDATE 10/18: READ IF YOU PLAN TO USE HUB WITH Zigbee2Tasmota

Many of us have seen the Sonoff Zigbee Hub and how easy it is to flash to Tasmota thanks to many awesome videos and my personal favorite by DigiblurDIY. The device is amazing and works well, but some things like your Zigbee bridge shouldn’t rely on WiFi.

Recently, another amazing individual going by Tube has created a homemade Franken Zigbee router using an ESP32 board, ethernet, zigbee, and a 3D printed case. It comes preflashed with ESPHome and is instantly compatible with Home Assistant ZHA or Zigbee2MQTT. However, each one of these devices is being made by hand and supply cannot meet demand.

I came across another wired zigbee hub using an ESP32 – the EACHEN Zigbee Bridge Pro. For only $30, I thought I would give it a try. It shipped from China, but arrived fairly quickly after only a couple of weeks.

The hub
An ethernet port, a USB-C power port, and a reset pin hole

The device is probably the same size as the Sonoff Zigbee Router. It is easy enough to disassemble though since there are no screws and the bottom can simply be pried off.

The board

The board pops right out. It is now ripe for flashing and you can see some solder still on mine. My experience with Tasmota so far had been with mainly Tuya-convert and flashing the Sonoff Zigbee router which did not require soldering. This was my first time soldering and was way more fun than I expected.

Now before we get to soldering and flashing, we need to compile our own Tasmota firmware. We need to make sure Tasmota has access to the Ethernet port and the Zigbee Radio. As in all things Tasmota, Blakadder has a page devoted to this device and instructions. The instructions were excellent, but assumed a certain level of knowledge to compile the firmware. Having not done this before, this part took me the longest. The tasmota32-zigbeebridge precompiled firmware mentioned on the site did not provide ethernet access or else this process would have been a lot easier.

After much trial and error, the easiest way I found to compile this firmware was by going to GitPod. After you log in, you are taken to a VS code window prepopulated with the latest Tasmota build.

The instructions from Blakadder’s website say to edit two files- user_config_override.h and platform_override.ini.

‘Platform_override.ini’ is located in the root directory – /workspace/Tasmota. Open the file, scroll to the bottom, and add:

[env:tasmota32-EWELINK]
extends                 = env:tasmota32
board_build.f_cpu       = 240000000L
board_build.f_flash     = 40000000L
build_flags             = ${env:tasmota32_base.build_flags} -DFIRMWARE_EWELINK

Now find the ‘user_config_override.h’ file which is located in the tasmota subdirectory (/workspace/Tasmota/tasmota). Open that file, erase all its contents and replace with:

#ifdef FIRMWARE_EWELINK
  #warning **** Build: FIRMWARE FOR EWELINK ZB-GW03-V1.2 ****

  #undef  SERIAL_LOG_LEVEL
  #define SERIAL_LOG_LEVEL LOG_LEVEL_NONE

  #define USE_ZIGBEE
  #undef  USE_ZIGBEE_ZNP
  #define USE_ZIGBEE_EZSP
  #define USE_UFILESYS
  #define USE_ZIGBEE_EEPROM // T24C512A
  #define USE_TCP_BRIDGE
  #undef  USE_ZIGBEE_CHANNEL
  #define USE_ZIGBEE_CHANNEL 11 // (11-26)
  
  #define USE_ETHERNET
  #undef  ETH_TYPE
  #define ETH_TYPE 0 // ETH_PHY_LAN8720
  #undef  ETH_CLKMODE
  #define ETH_CLKMODE 3 // ETH_CLOCK_GPIO17_OUT
  #undef  ETH_ADDRESS
  #define ETH_ADDRESS 1 // PHY1
#endif

Ok, so those two parts were relatively easy, but the next part on how to compile took me probably longer than it should have to figure it out. In the terminal at the bottom of the screen, while in the /workspace/Tasmota directory, type the following:

platformio run -e tasmota32-EWELINK

Now wait patiently for the new firmware to compile. Once it does, it can be found in /workspace/Tasmota/build_output/firmware. Download ‘tasmota32-EWELINK.bin.

I compiled this on 10/7/2021, Tasmota32 9.5.0. I promise that I did not tamper with it (and would not know how to tamper with it if I wanted), but you should probably not download firmware from some random guy on the internet.

Ok, now that we have the firmware, it’s time to start flashing. Since we have an ESP32. I do not believe we can use Tasmotizer. I have Windows and used ESP-Flasher-Windows-x64. Open it up, choose your serial port, the firmware we just compiled.

Now the fun part with soldering. Below I have a photo of the ESP32 board and the corresponding connection on my Serial Adapter (I use this one).

ESP32 board – labels point to corresponding pin on Serial Converter
Serial Converter – labels point to corresponding pin on ESP32

Now Flash.

Once you finish, it’s a matter of setting up Tasmota and a few more finishing touches.

Set up Tasmota through the access point first and add this Template by issuing the following command:

backlog Template {"NAME":"ZB-GW03-V1.2","GPIO":[0,0,3552,0,3584,0,0,0,5793,5792,320,544,5536,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,608,640,32,0,0,0,0,0],"FLAG":0,"BASE":1} ; module 0

From this website, select ncp-uart-sw-6.7.8_115200.ota. Go to the upgrade firmware screen to update the zigbee radio. The device will automatically recognize this as firmware for the zigbee radio and will apply it accordingly.

Now try plugging the device in to Ethernet. I noticed it was sort of strange and took a couple reboots and unplugging and plugging the cable back in, but I saw messages about setting up the Eth connection in the console. There was no real way to change Ethernet settings like you can with WiFi, but I noticed two DHCP listings in my router. Once Ethernet is set up, you can disconnect WiFi with the following, but do not do the following until Ethernet is set up! Make sure the first command turning WiFi off works first before applying the subsequent rule which will disable it on each reboot. The first command by itself will not persist across reboots.

Wifi 0
backlog rule2 on system#boot do Wifi 0 endon ; rule2 1

If something went wrong and now you are locked out of the device because Ethernet isn’t working and WiFi is down, you can try Tasmota device recovery.

The device is now set up to use with Zigbee2Tasmota. For Home Assistant, there are a few more steps.

To integrate with Home Assistant, we must remap the Zigbee Tx and Zigbee Rx pins directly to TCP Tx and TCP Rx. This will disable Zigbee2Tasmota, but will allow the device to integrate with Home Assistant. Use the following command to update the template:

backlog template {"NAME":"ZHA-bridge","GPIO":[0,0,5472,0,5504,0,0,0,5793,5792,320,544,5536,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,608,640,32,0,0,0,0,0],"FLAG":0,"BASE":1} ; module 0

Notice the change in the third and fifth positions. Afterwards, it will be possible to start the TCP Server which is what ZHA needs to connect to the coordinator.

Enter the following from the console to turn on the webserver for the Zigbee radio:

backlog rule1 on system#boot do TCPStart 8888 endon ; rule1 1 ; tcpstart 8888

Finally, you can jump into Home Assistant and set up the device for ZHA exactly how it’s (masterfully) described by DigiBlur.

https://www.digiblur.com/2020/07/how-to-use-sonoff-zigbee-bridge-with.html

Thanks for reading. I hope this helps fill in the blanks for some folks like myself who are not as familiar with the inner workings of Tasmota. Please let me know if you have any questions.

Thanks to DigiBlur and Blakadder and all the other folks who did the hard work in getting this device to work.

Link to Purchase

Affiliate Link:

AliExpress.com Product – EACHEN EWeLink Zigbee Bridge Pro (Zbbridge Pro)

eWelink ZigBee 3.0 Smart Wired Wireless Gateway Hub

Non-Affiliate Link:

AliExpress.com Product – EACHEN EWeLink Zigbee Bridge Pro (Zbbridge Pro)

eWelink ZigBee 3.0 Smart Wired Wireless Gateway Hub

EACHEN Website:

EACHEN eWeLink Zigbee Bridge Pro (zbbridge pro)


CORRECTION 10/2: added steps to remap zigbee Tx and Rx to TCP.

CORRECTION 10/7: made changes based on feedback from /u/Vertigo722. Edited platformIO text. Changed some order of setup.

CORRECTION 10/14: see comments below. Hard rest of coordinator breaks connection with ZHA until toggled back to Z2T and then back again. Using this firmware and the rules below automatically toggle back and forth only on cut power. Hopefully this workaround fixes things for now.

UPDATE 10/15: READ IF YOU PLAN TO USE HUB WITH ZHA

UPDATE 10/18: READ IF YOU PLAN TO USE HUB WITH Zigbee2Tasmota

21 thoughts on “A Wired Sonoff Zigbee Alternative”

  1. Thanks for the guide. Works perfect. There is a small error in the image of the ESP32 board: the IO0 pin has a label GND.

    1. Glad you liked it! Actually, maybe it isn’t clear enough, but the labels on the ESP32 board are meant to show you what each pin should be connected to. I’ll see if I can update that to make a little more clear. Thanks for the feedback!

  2. Hello,

    Thank you for your guide. There is a problem. So if you make a power reboot, after does not work in ZHA. It will work again if you change the TCP RX and TX to Zigbee TX and RX and after change back to TCP Rx and TX. So every power reboot you should do this… 🙁

    1. Hey thanks for bring this up. This was noticed by u/Vertigo722/ on Reddit and I confirmed it. The reason it took so long to detect though is because really, you can set and forget this thing. There really isn’t a need to power cycle it let alone unplug it from the wall and fortunately, when it is rebooted through software, it doesn’t have the disconnect issues as far as I could tell.

      I have been working on a work around and I think I am really close. I finally (took a really long time) figured out how to preinstalled the two templates for Z2T and ZHA as modules in the compiled Tasmota. Later today I’m gonna work on setting up a rule where after only after a hard shutdown and reboot, the template will automatically change to Z2T and then after rebooting to change the template, will go back to ZHA. Hopefully should have this figured out later today and will get back to you.

      Thanks!

    2. Ok, I think I figured it out if you wanna try it. These rules and a new firmware should automatically toggle between ZHA and Z2T just after the poewr is pulled but not with software restarts.

      I will post the new bin file above, and use the following rules:

      backlog rule1 on system#boot do backlog wifi 0; TCPStart 8888 endon; rule1 on
      backlog rule2 on Info3#RestartReason=Vbat power on reset do module 3 endon; rule2 on
      backlog rule3 on ZbState#Message=Started do module 2 endon; rule3 on

      1. Thank you for your fast solution! So I tried it but does not work. I flashed the new bin file and follow the steps. I would like to use it via wifi and I skipped the Ethernet part. Currently if I make a power reboot it cannot connect to my Wifi network. I don’t know what do I wrong…

        1. Hey I changed the third rule. I think this should work better. Gives the zb radio a chance to reset. If you want WiFi, you would have to modify the first rule as the first rule turns off the WiFi now. Use this:

          backlog rule1 on system#boot do TCPStart 8888 endon; rule1 on

          If you already did the first rule, your WiFi will be disabled across reboots. You might need to temporarily plug it in to an Ethernet port to modify the rule and then you should be good to unplug it again. Otherwise, you might have to go through the tasmota reset procedure.

  3. Hi, thanks for the helpful explanation. I want to run the bridge with only zigbee2tasmota active; it works up to the point where I select “Zigbee Permit Join” – this causes the device to reboot.

    In the ZHA mode it was possible to pair some sensors but ideally I want the bridge to function independently for redundancy reasons.

    The log does not show anything upon selecting Zigbee Permit Join – any thoughts what causes the reboot?

    1. Hmm I only played with zigbee2tasmota briefly on this device, but didn’t have an issue. I’ll play with it a bit more and see if I have any problems.

      Which zigbee firmware are you running?

      1. I updated to the version you suggested; is there any way (in the console?) to check?

        With ZHA I can add devices without problems, once added through ZHA they can be seen in Z2Tasmota. I also tried to join devices by using a console command, same behavior, a complete reset of the bridge.

        1. I noticed the same behavior. My experience with Zigbee2Tasmota had been with the Sonoff so to be honest I guess I had never tried it before.

          I tried the 6.7.9 zigbee firmware and same result. I tried compiling a custom firmware with the development branch to see if it is a bug that has been corrected and now my device won’t start. Will have to solder it and flash again so will need to get back to you.

    1. Hey which firmware are you using? One thing I noticed was that the ethernet didn’t work for me when I used a low power wall adapter. I saw the ethernet constantly connecting and disconnecting in the logs. It also took me a few times of turning it on and off and plugging and unplugging at one point to get it working. Not sure if you tried playing around with that part at all.

    2. Something I just saw in the Home Assistant forum, since the Ethernet on the device is 10/100, if your device doesn’t automatically do it, you may need to set your router manually for 100mbps instead of 1gbps.

  4. Hi there,
    It’s awesome! BUT, when the hub restarts home assistant can’t connect to HUB.
    Can you help me solve this problem?

  5. Hi everyone, I bought this zigbee coordinator, and after some trials and error I finally came to this :
    – I tried the tutorial on this page and on the page about the update for the ZHA workaround after power cycle restart. However both these solutions were not working correctly for me : Each time the device power cycle, my Blitzwolf SHP13 power socket needed to be re-appaired.
    – So i find out that we don’t need to go to the Zigbee2Tasmota module then switch back to ZHA module : You simply need to follow the tutorial on this page, but instead of

    backlog template {“NAME”:”ZHA-bridge”,”GPIO”:[0,0,5472,0,5504,0,0,0,5793,5792,320,544,5536,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,608,640,32,0,0,0,0,0],”FLAG”:0,”BASE”:1} ; module 0

    You should use :

    backlog template {“NAME”:”Zig_Bridge32″,”GPIO”:[1,1,5472,1,5504,1,1,1,5793,5792,320,544,5536,1,5600,1,0,1,1,5568,0,1,1,1,0,0,0,0,608,640,32,1,1,3552,3584,1],”FLAG”:0,”BASE”:1}; module 0;

    The explaination is (i think, i am not sure) :
    – In the ZHA-bridge template, there is no more Zigbee Tx and Zigbee Rx GPIO, so tasmota do not RESET the EZSP chip at boot, so in my Zig_Bridge32 template, I simply set Zigbee Rx and Zigbee Tx to some unused GPIOs, so that at boot, tasmota will do the EZSP chip reset, and thus work correctly. Of course the Zigbee2Tasmota UI will be here but not usable, however the TCP connection will be!

    Zigbee2MQTT tip :In your Zigbee2MQTT config, you can add

    availability:
    active:
    timeout: 1

    so that if there is a reboot of the bridge, it will try to reconnect under 1 minute.

    Hope it will help !

Leave a Reply

Your email address will not be published. Required fields are marked *