Skip to main content

Tasmota

Tasmota is generally an open-source firmware for devices built on ESP8266 and ESP32 chips. Thanks to the fact that some Zigbee gateways run on these chips, it is possible under certain circumstances to upload custom firmware and have the gateway fully under your control.

Tasmota logo

I assume you are already familiar with the basics of Zigbee and so you should start by choosing a gateway suitable for Tasmota.

Advanced Topic

Unlike using ZHA, Zigbee2MQTT, or deCONZ through a USB coordinator, using Zigbee2Tasmota is much more complex and requires physical intervention in the device through custom firmware, which needs to be disassembled.

We can narrow the choice down to two products. One from Sonoff using a combination of Zigbee + WiFi and a product containing ESP32 with Ethernet sold under several brands.

zigbeewifi
Ewelink ZB-GW03 EU Zigbee 3 Ethernet Bridge

Ewelink ZB-GW03 EU Zigbee 3 Ethernet Bridge

ESP32 with Ethernet and Zigbee
zigbeewifi
Sonoff Zigbee Bridge-Pro

Sonoff Zigbee Bridge-Pro

ESP32 with WiFi and Zigbee

In the case of Ewelink ZB-GW03 (and its similar variants), there is often an option to choose a version with Tasmota pre-installed when ordering, which saves you the most demanding part, and you can skip the following chapter.

Tasmota Buy Choice

Tasmota flashing

The variant with pre-installed Tasmota has been tested and saves a lot of work.

Just plug the box into an Ethernet cable, it should get an IP address via DHCP, and it should be ready to use.

Just a small note - the Ethernet socket surprisingly has no activity LED, which surprised me, and at first, I thought the socket was not working.

Sonoff Zigbee Bridge-Pro

For Sonoff and its Sonoff Zigbee ZBBridge-Pro, this is not the case, and you either stay with the original firmware, which only fully supports Sonoff products, or you try to flash the firmware with Tasmota.

To upload the firmware, you will need at least these two products:

usb
CP2102 USB 2.0 to TTL UART Module

CP2102 USB 2.0 to TTL UART Module

USB to UART TTL serial converter for firmware upload via USB
Produkt nebyl nalezen.

Flashing Firmware - Uploading Tasmota

For a more detailed procedure on flashing Tasmota firmware into ESP8266 / ESP32 chips, you can look at the Tasmota article, and here we will only mention the specifics for Sonoff Zigbee ZBBridge-Pro.

Disassembly - How to Get Inside the ZBBridge

Tasmota flashing

I still have the non-Pro variant, which differs mainly by the chip - instead of ESP8266, it contains ESP32, but the procedure should be the same.

To get to the board, you need to peel off the rubber feet from the bottom side, under which there are four screws.

After removing them, the box can be easily opened, and the board can be taken out of the plastic case.

Connecting Pins - How to Connect UART to the Board

Tasmota flashing

The most important information - how to connect UART to Sonoff Bridge

ZbBridgeAdapter
ETXRX
ERXTX
IO0 (GPIO00)GND
GNDGND
3v33V3/VCC

Uploading from the Computer - How to Replace the Original Firmware with Tasmota

Once we have the board connected to the UART serial connector, we can download a special version of Tasmota for ZBBridge called tasmota-zbbridge for the non-Pro version and tasmota-zbbrdgpro for the newer Pro version.

Only for ZBBridge (not for Pro version)

To upload Tasmota firmware to ESP2866, you also need to update the firmware for the Zigbee chip. This step can be done through the Firmware Upgrade menu in Tasmota. Here, select Upgrade by file Upload and then the file ncp-uart-sw_6.7.8_115200.ota, which you need to download to your disk first.

Tasmota flashing Zigbee

Tasmota flashed

Zigbee Firmware for Pro Version

Unfortunately, the guide for ZBBridgePro is somewhat more complicated, and I don't want to include it here until I test it. If you have this version, try looking at this guide in English.

Using Tasmota Firmware

From this point on, everything applies to both hardware - i.e., both Sonoff and the alternative ZB-GW03.

Tasmota firmware can be used in two ways:

  1. As a direct Zigbee coordinator based on Zigbee2Tasmota - Zigbee devices are paired directly into Tasmota, but the functionality is very limited.

    If you have HomeAssistant, you can ignore this

    I will not go into this method further, as in our case, when running Home Assistant, we would unnecessarily limit ourselves.

  2. As a remote Zigbee coordinator connected to ZHA or Zigbee2MQTT - through Ser2Net (serial to network) technology, which allows us to share the serial port over Ethernet / WiFi. This way, we have full functionality of ZHA or Zigbee2MQTT through a coordinator that is physically located anywhere in the Ethernet / WiFi network.

Tasmota as a Remote Zigbee Coordinator

To use with ZHA or Zigbee2MQTT, we will need to switch Tasmota from a direct Zigbee coordinator to remote mode.

We will do this as follows:

  1. Connect to the Tasmota web interface and in Configuration -> Configure Other, set the Template value in the Other parameter section:

    • for ZBBridge:

      {"NAME":"ZBBridge","GPIO":[56,208,0,209,59,58,0,0,0,0,0,0,17],"FLAG":0,"BASE":18}
    • for ZBBridgePro:

      {"NAME":"ZBBridge Pro","GPIO":[0,0,576,0,480,0,0,0,0,1,1,5792,0,0,0,5472,0,320,5793,5504,0,640,608,32,0,0,0,0,0,1,0,0,0,0,0,0],"FLAG":0,"BASE":1}
    • for ZB-GW03 it is not necessary to change, but for sure I include it:

      {"NAME":"ZB-GW03","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}

    and don't forget to check Activate and save.

    Tasmota flashed

  2. Add a new rule to Tasmota through the console, which will start sharing the coordinator over TCP. In the console, run this command:

    Rule1 ON System#Boot do TCPStart 8888 endon

    and we should see approximately the following response about adding the rule and starting the TCP service on port 8888.

    13:52:19.563 CMD: Rule1 1
    13:52:19.567 RSL: RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":37,"Free":474,"Rules":"ON System#Boot do TCPStart 8888 endon"}}
    13:52:19.770 RUL: SYSTEM#BOOT performs "TCPStart 8888"
    13:52:19.772 TCP: Starting TCP server on port 8888
    13:52:19.774 RSL: RESULT = {"TCPStart":"Done"}

With this, we have completed the preparation on the ZBBridge side, and the rest of the setup depends on whether we choose ZHA or Zigbee2MQTT.

Tasmota with ZHA

If we decide on ZHA, we can do the entire next setup through Home Assistant.

  1. Add ZHA Integration: - In the Settings menu -> Devices & Services, add the ZHA Integration.

    Or click on:

    Open your Home Assistant instance and start setting up a new integration.
  2. Choose to enter manually: in the next step, when selecting the port, choose to enter manually (Enter Manually).

    Tasmota flashed

  3. Radio Type:

    • for ZBBridge and ZB-GW03 - leave EZSP, which corresponds to the firmware we manually uploaded to ZBBridge or received with ZB-GW03.
    • for ZBBridgePro - change to ZNP.

    Tasmota flashed

  4. Enter the IP address of the ZBBridge running on Tasmota with port 8888 and leave everything else in the default settings.

    Tasmota flashed

  5. And we are done!

    Tasmota flashed

Pairing new Zigbee devices and any other Zigbee network settings are then done the same way as if we had a local coordinator.

Tasmota with Zigbee2MQTT

Setting up Zigbee2MQTT is a bit more complicated, as it is not a standard part of Home Assistant like ZHA.

  1. Install the Zigbee2MQTT add-on: for a detailed guide, see here.

  2. Configure the coordinator over TCP: in the MQTT add-on settings, enter the coordinator configuration:

    • for ZBBridge:
      serial:
      port: 'tcp://[zbbridge_ip]:8888'
      adapter: ezsp
    • for ZBBridgePro:
      serial:
      port: 'tcp://[zbbridgePro_ip]:8888'
  3. Start the add-on and check the log, where we should see the use of the remote coordinator:

    [14:29:37] INFO: Preparing to start...
    [14:29:38] INFO: Socat not enabled
    [14:29:38] INFO: Starting Zigbee2MQTT...
    Zigbee2MQTT:info 2024-01-28 14:29:43: Starting Zigbee2MQTT version 1.35.1 (commit #unknown)
    Zigbee2MQTT:info 2024-01-28 14:29:43: Starting zigbee-herdsman (0.30.0)
    Zigbee2MQTT:debug 2024-01-28 14:29:43: Using zigbee-herdsman with settings: '{"adapter":{"concurrent":null,"delay":null,"disableLED":false},"backupPath":"/config/zigbee2mqtt/coordinator_backup.json","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","databasePath":"/config/zigbee2mqtt/database.db","network":{"channelList":[11],"extendedPanID":[208,179,129,254,180,173,38,130],"networkKey":"HIDDEN","panID":29024},"serialPort":{"adapter":"ezsp","path":"tcp://10.2.1.202:8888"}}'
    Zigbee2MQTT:info 2024-01-28 14:29:48: zigbee-herdsman started (resumed)
    Zigbee2MQTT:info 2024-01-28 14:29:48: Coordinator firmware version: '{"meta":{"maintrel":"8 ","majorrel":"6","minorrel":"7","product":8,"revision":"6.7.8.0 build 373"},"type":"EZSP v8"}'
  4. Done and we can use Zigbee2MQTT to pair new Zigbee devices.

Experience with Zigbee2MQTT

For some reason, in my case, the coordinator through ZBBridge and Zigbee2MQTT worked quite poorly. Even when pairing a new Zigbee device, it wrote timeouts and eventually did not respond to requests within the limit.

There was no such problem with ZHA, and I still don't know what could have caused it.

Zigbee2MQTT:error 2024-01-28 14:39:14: Failed to configure '0x60a423fffed2ead1', attempt 1 (Error: Bind 0x60a423fffed2ead1/1 genOnOff from '0x60a423fffe425611/1' failed ({"address":7074,"clusterId":32801,"sequence":7} after 10000ms)
at Timeout._onTimeout (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:64:35)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7))

Comments