ZHA OTA Firmware Update / Upgrade

Hi all,

I had a problem with my Aliexpress Tuya TS011F / TZ3000 Zigbee plug that it randomly turned off.
Spending some time in Google found people suggesting that a firmware update solved it for them.

This guide should work for any OTA update available and not only for this specific plug

Since I don’t have a Tuya Zigbee Hub I had to update the firmware with ZHA, which involves a few steps and wasn’t obvious for me. This post aims to explain step by step how to update the plug’s firmware.

Step 1: Configure ZHA OTA updates

Followed this guide to get it working.

  1. Create a zigpy_ota folder inside your config folder
  2. Add this to your configuration.yaml:
       otau_directory: /config/zigpy_ota
       ikea_provider: true
       ledvance_provider: true
  3. (Optional but useful) Add this for logging purposes to configuration.yaml:
    default: info
      homeassistant.components.zha: debug
      zigpy: debug

Step 2: Check current firmware version

Get into the device page (Settings > Devices & Services > Devices tab and click on the device) and open Manage zigbee device:


Now select the Ota Cluster and in the Attribute dropdown select downloaded_file_version and click Read Attribute:

This represents the firmware version. Just note the Value to know if the upgrade was successful. Mine is already updated so it may be different.

If you have an IKEA or Ledvance device, skip Step 3.
This is because ZHA is automatically downloading firmwares for these two vendors. But we have to manually do it for others.

All available firmware updates can be found here: https://github.com/Koenkk/zigbee-OTA/blob/c29406257053fb5378723101535a16e278fc3ebc/index.json

Step 3: Download the firmware

Get into the ota directory and download the firmware:

cd /config/zigpy_ota
wget https://images.tuyaeu.com/smart/firmware/upgrade/20220907/1662545193-oem_zg_tl8258_plug_OTA_3.0.0.bin

Step 4: Restart and check logs

Restart HomeAssistant and if you enabled logging, you can run this command in your config directory to check if it is in fact updating:

tail -f home-assistant.log | egrep 'zigpy.ota|zigpy.util|zigpy.*OTA'

If the update is detected and sent to the device you should see something like;

2022-11-14 16:55:08.460 INFO (MainThread) [zigpy.ota.provider] Trådfri: OTA provider enabled
2022-11-14 16:55:08.466 INFO (MainThread) [zigpy.ota.provider] Ledvance: OTA provider enabled
2022-11-14 16:56:12.562 DEBUG (MainThread) [zigpy.zcl] [0xA81A:1:0x0019] OTA query_next_image handler for '_TZ3000_typdpbpg TS011F': field_control=FieldControl.0, manufacturer_id=4417, image_type=54179, current_file_version=74, hardware_version=None, model='TS011F'
2022-11-14 16:56:12.605 DEBUG (MainThread) [zigpy.zcl] [0xA81A:1:0x0019] OTA image version: 192, size: 307682. Update needed: True
2022-11-14 16:56:21.744 DEBUG (MainThread) [zigpy.util] Duplicate 146 TSN

This means that it found the new firmware and it is updating it. Wait for some time (I can’t tell how much) and go back to the Device page and repeat Step 2 to check if the version if different. If it is then it worked!

If it didn’t keep reading.

Step 4: :frowning: Update didn’t work on restart

You can manually trigger an update and it’s easy.

First find the device IEEE by going into the Device page and copying the value that is just in the dropdown view below the Device Info

Go to the Developer Tools, open the Services tab and click the GO TO YAML MODE button.

Then paste this replacing <device_ieee> with the Device IEEE you just copied and click on the Call Service button.

service: zha.issue_zigbee_cluster_command
  ieee: <device_ieee>
  endpoint_id: 1
  cluster_type: out
  command_type: client
  cluster_id: 25
  command: 0
    - 0
    - 100

You can check the logs as in Step 4 and see if the firmware is detected and the updated fired.

My Device Logbook now reports Attribute Update every few minutes, preventing I guess to going off:

Hope this helps someone that has the same problems I have and clarifies this situation.
Probably this will be updated and an UI functionality would be added to do this like it already exists in Zigbee2MQTT or ZWaveJS. In the meantime this looks like the only solution.


I couldn’t post more than one image as I’m a new user in the community so here is a snapshot of the Ota Cluster downloaded_file_version attribute:

1 Like

And here is my Device’s Log Book after the firmware upgrade:


Nice! Even better if you be willing to contribute improvements to both ZHA integration documentation (which needs to be keept short) as well as improve the zigpy wiki (which can be long) on the subject:



Hello Victor,

Thanks for the details! This post is the first one I’ve seen that is complete in addressing the bug in the TS011F / TZ3000 Zigbee plug. It also fills a number of gaps for me (and I imagine a lot of other users out in the world).

Regarding the detail at the end of step 2, “If you have an IKEA or Ledvance device, skip Step 3.”

I see two step 4 sections. I think the first step 4 should be step 3, "Download the firmware. That makes step 2 correct.

In step 5, after adding the “data:” section to the YAML file with the IEEE address of the device to be updated, can you please mention that the user needs to press the “Call Service” button?

Many Thanks,

Done! Thanks for your suggestions!

Also check out the OTA notify feature in zha-toolkit:



1 Like

Does anyone know where I can download firmware for Sengled devices (Device info E1C-NB7 by sengled)?


I’m not sure I followed how you found the entry for your specific device in that huge json file to know which firmware file to download.

Does this also work with downgrading ? (i.e. it will simply update the device with whatever firmware file is in the ota folder ?

For being honest I found it by chance after spending several hours in here and in github issues. There I found a guy sharing the link (IDK how he found it, probably he sniffed it from the update process itself) which then searching it in google pointed me to the JSON file.

Others are easier to find since they have more descripive names and even the manufacturer and the model.

Anyway you don’t need to, just download all of them as explained and it will trigger automatically the pertinent updates.

AFAIK it won’t trigger downgrades automatically. Although you can do it manually with another command code.

Just fixed a smart plug I have, which it was randomly switching off, thanks to your post. After forcing to update firmware, now it seems it is working as expected. Thank you so much!

1 Like

I have tried all possible ways to update the firmware of my Danfoss Ally TRVs but nothing works.
Is there anything to configure besides the ZHA lines in the configureation YAML?
I have initiated several restarts, the zha.issue_zigbee_cluster_command and with the zha_toolkit/ota_notify.
And of course I have specified the OTA-directory and the files are in there.

My HAOS is running on a Raspberry Pi 4 with a RaspBee II.

The updates can take up to 30 minutes.

What I’ve found with this method is that is not always reliable. What it has always worked for me apart this, it’s been using Zigbee2MQTT addon.

You need to install the addon, then disable the ZHA integration (which won’t lose your current network and will remember it when you re-enable it). Then pair run the Z2M addon, pair the device you want to update and go the OTA tab. You will have a list with the devices that can be updated.

Wait for the update to complete, it’s slow. Then stop the addon and re-enable the ZHA integration.

Hmm… can’t get the addon working. After starting the addon “502: Bad Gateway” is displayed and then the addon crashes…

23:41:20] INFO: Preparing to start...
[23:41:20] INFO: Socat not enabled
[23:41:22] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2022-12-11 23:41:27: Logging to console and directory: '/config/zigbee2mqtt/log/2022-12-11.23-41-26' filename: log.txt
Zigbee2MQTT:info  2022-12-11 23:41:27: Starting Zigbee2MQTT version 1.28.4 (commit #unknown)
Zigbee2MQTT:info  2022-12-11 23:41:27: Starting zigbee-herdsman (0.14.76)
Zigbee2MQTT:error 2022-12-11 23:41:47: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-12-11 23:41:47: Failed to start zigbee
Zigbee2MQTT:error 2022-12-11 23:41:47: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-12-11 23:41:47: Exiting...
Zigbee2MQTT:error 2022-12-11 23:41:47: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:103:27)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/app/lib/zigbee.ts:58:27)
    at Controller.start (/app/lib/controller.ts:101:27)
    at start (/app/index.js:107:5)

Did you disable the ZHA integrations as I mentioned? Looks like you didn’t.

You have to click on the 3 dots on the integration and click Disable.

If that doesn’t fix it, which it should, you can follow the link in the error which lists the main causes and the solutions.

I have disabled the ZHA and also tried the solution shown in the link. Does not fix the error…

Have you tried changing the port? Mine was succesfully detected but you may need to set ttyUSB0 or the ttyACM0, also if you have multiple USBs used it may be a different number.

Also is it possible that your adapter is not compatible with Z2M. I can’t see it here:

I’m currently trying to find another port. The RaspBee II is in the “other” section of the recommended ones.

Hey, thank you so much for your help and your time! But atm it seems to me this is not worth the effort. So I will wait for an integrated solution in ZHA or go with the current firmware.

I have the same plug and it pairs with HA “sonoff dongle” for a few minutes and then it becomes unavailable, I can’t upgrade frameware or do anything with it

i tried to pair it not directly to hub and instead, i pair it with one of the repeaters " Aqara wall switch" and yet it does the same behavior

your above tutorial is well explained and helped me to understand OTA update very well but unfortunately, i couldn’t able to do the upgrade,