Solvedesp homekit devices Flashing Tasmota device OTA with esp-homekit-devises

Is it possible to flash a device that is running Tasmota with esp-HomeKit-devices OTA? When I try to upgrade the firmware with main.bin from HAA I get an error: “ Magic byte is not 0xE9”. Thanks for any help on this!

57 Answers

✔️Accepted Answer

The process is very easy but if you haven't done so before it might feel complicated. You will need a raspberry with WLAN capability and a secondary device with wifi capabilities (i.e. mobile, tablet,pc). I had a rpi 2 with a usb wifi adapter, but it should work with rpi3/rpi4.

To my understanding, all devices running tuya software are looking for a known SSID network when are in pairing mode. Once they are connected to that network, they can be updated. This is exactly what the tuya-convert does. It creates an AP on the RPi and emulates the update process. It can serve Tasmota, ESPurna or any other software we like, in our case LCM which will lead us to HAA.

Note: this process may lead to a bricked/faulty device. It worked for me, but may not work for somebody else. I won't be able to provide help if something goes wrong and your device is bricked. If you want to take the risk though, then here are the steps I followed:

  1. First of all I strongly suggest to prepare a SD card with the latest clean Raspbian OS and no other software on it. Raspberry should be connected via LAN cable to your network because its WIFI will be used for creating an AP. As soon you are able to log into the raspberry you should be good to proceed with the next commands.

  2. run the following commands:

# git clone
# cd tuya-convert
# ./

During the above steps, I was asked to deactivate some processes. I confirmed everything with "Y" as I didn't mind. You are suggested to do the same. That's why working on a brand new Raspbian installation matters.

  1. Make sure your wifi adapter is identified as "wlan0" by running the following command
    # iwconfig

If by any chance your wifi adapter is identified as "wlan1" you will need to use your favorite editor and correct the following file. In that case, the command would be :
nano config.txt

  1. Download the file from this link and put it into folder ~/tuya-convert/files/

  2. You are now able to start the AP process by giving the next command:
    Wait until you reach to a point where it says "3. Press ENTER to continue"

  3. Take your secondary device and connect to a wifi network called "vtrust-flash". I don't know why this is needed but I did it as this was part of the process. There will be no other use for the secondary device.

  4. Take your smart IoT device and put it into pairing/setup mode. For me, all I needed to do was press the button for a few seconds. Then the led started blinking fast.
    Risk mode ON

  5. Press Enter to the rpi terminal and watch the process. It will take a few seconds. Mainly, the process backup the current factory firmware and then loads a temporary firmware to the device that will help you load the third party firmware you want. I believe this is the point where no restart is allowed as it would negatively affect the whole process.

  6. As soon as the previous process is completed, a few options are offered. Option '0' loads the original firmware back. Option '3' will load the thirdparty.bin (supposingly you did copy the file in step 4). Press 3 and wait. The process will take a few seconds and once done the IoT device will restart.

This was it. If you search for Wifi networks you will find LCM-xxxx, the rest of the process is well known.

Extra Notes to keep in mind:
Please be extra careful in what you do. Since those IoT devices do not offer serial PINs like Sonoff devices, it will be very difficult to solder wires and flash using the normal method.

Although the tuya-convert process saves the original firmware, if you run all steps of the above guide, you will end up with LCM firmware hence you won't be able to go back to original firmware without soldering wires.

Good luck!

Other Answers:

I added Tasmota compatible binary to release files. I will support it.

So I did next test with new sonoff mini.

  1. flash from vanilla mini via [OTA] to tasmota ( OK
  2. flash from tasmota to homekit-from-tasmota.bin (md5 c5f3bea97c7630871ad1e826baed7c38) OK, HAA wifi available
  3. on HAA wifi setting my wifi/ssid+pass (no json), saving - OK
  4. mini got IP, correctly - can ping it,
  • but unable start setup mode (pressing buttons, diy pin,)
  • nc -kulnw0 45678 shows

Get version RavenSystem/haa_ota
NEW CONNECTION LocalPort=e372 DNS IP: local..OK remote..OK SSL..OK set_fd to port 443..OK

GET /RavenSystem/haa_ota/releases/latest HTTP/1.1


GET /RavenSystem/haa_ota/releases/latest HTTP/1.1

HTTP returns 302 for Current ROM is 0
3.0.2 with 2.2.2 = 1
Current ROM is 0
Running BOOT
Get hash
GET /RavenSystem/haa_ota/releases/download/3.0.2/main.bin.sig HTTP/1.1

NEW CONNECTION LocalPort=e373 DNS IP: local..OK remote..OK SSL..OK set_fd to port 443..OK
sent OK
HTTP returns 404
Get file
GET /RavenSystem/haa_ota/releases/download/3.0.2/main.bin HTTP/1.1

NEW CONNECTION LocalPort=e374 DNS IP: local..OK remote..OK SSL..OK set_fd to port 443..OK
sent OK
HTTP returns 404

But when checking the HAA OTA releases page, resource names should be IMHO rather haaboot.bin and NOT main.bin
So seems will have to solder again.

I had some time today so I took a closer look. I was mistaken earlier in saying that an intermediate firmware would be needed, turns out the eboot in Tasmota can be used to do the upgrade just fine.

Older versions of Tasmota (< should be able to upload the assembled multipart binary as is. Newer versions of Tasmota include a Tasmota version check. Assuming you want to upload a Tasmota firmware, this ensures they are compatible versions. If you try uploading a different firmware, you'll get a very unhelpful "incompatible" error message.

Luckily we can trick the version check pretty easily as it just looks for some magic bytes. All we need to do is append this marker with a high "version number" and it will be accepted by Tasmota. The magic sequence is A55AA55A FFFFFFFF 5AA55AA5.

I've gone ahead and made the above modifications to the multipart homekit binary, tested and working fine on my development board. Attached here if you would like to try it for yourself.

I see that I forgot to change flash settings back from my development board. I fixed this and just updated the link, download the updated binary and try again.

Related Issues:

esp homekit devices Flashing Tasmota device OTA with esp-homekit-devises
The process is very easy but if you haven't done so before it might feel complicated ...
esp open sdk Compiler fails on MacOS 10.14
Thanks to all of you for your contributions to this thread After trying for hours I was finally able...
Tasmota MagicHome LED (ESP-IR-B-v2.3 / ESP8285MOD ESP-M2) not working with tasmota f/w
Well I worked mine out Color order was just a case of switching the PWM1 and PWM2 because my LED str...
Tasmota More effects with leds
Hello everyone First of all thank you for this wonderful library I have found it very useful ...
homie esp8266 [develop-v3] OTA failing
Hey guys I found the problem and learned a few things along the way The hardware WD timer was being ...
Tasmota lc technology 2ch relay
Closing issue as there is no feedback Please when you have time tell us if the proposed solution wor...
Tasmota Upgrade to Tasmota from Shelly mongoose trough SW ( not cable)
@seritos - it seems that the upload to the ftp server did not work for some builds but the actions w...
Tasmota Alternative PWM implementation for ESP8266 devices
Hi All I know this is an old issue This thread came up when I was looking to use Tasmota to control ...
nodemcu firmware Policy of supporting Lua in ROM
OK It looks as if I have ironed out most of the issues and can put together an evaluation PR ...
platformio core Debug by CLion
Hi all There is a piece of good news here We are so happy to present the first MVP of the PlatformIO...
nodemcu firmware Upgrade to SDK 3.0 -- update 1
I'll do the proper PR today or tomorrow Sorry guys but I've been a bit poorly and this has hit my ab...
TinyGSM Library not working with ESP32 hardware Serial2
@vshymanskyy sorry for the untidiness I have quickly assembled this example to download .bin server ...
Tasmota Alexa issue
You can try setoption41 40 PROBLEM DESCRIPTION I have been using the Tasmota version 6.3.0 for about...
Tasmota multiple switchtopics?
As you are running WITHOUT a relay it is not a sonoff and therefore anything could happen but appare...
IRremoteESP8266 Adding Support for Carrier AC 72 bit
I added some debug messages to see why 56 bit swing send does not work and so far I confirmed that t...
IRremoteESP8266 Sending Raw as hex, possible timing issues.
You probably won't love my solution but because the infoglobe protocol does not have both spaces and...
nodemcu firmware enduser_setup "Handling POST" failure on 310faf7 and dev
Can we roll back to the version in for the next drop to master giving someone with motivatio...
homebridge Cannot find module '../build/Release/dns_sd_bindings'
Ok i found a solution ! You need to do sudo npm install --unsafe-perm mdns and sudo npm rebuild --un...
homebridge Cannot find module '../build/Release/dns_sd_bindings'
I fixed it I found the solution in the answer to #905 (slightly edited): I just installed a clean an...
homebridge Testers Wanted: Homebridge v1.3.0 Beta!
Hello beta testers For those of you have have enabled the Ciao mDNS library Over the last couple of ...
homebridge Sprinker and Faucet services
Not yet I'll try to add those soon. Does homebridge already support Sprinkers and Faucets? Does anyb...