Tuya ESPHome "Initialization failed. Current init_state: 0"

I recently just flashed my Atomi (Tuya branded heater) with ESPHome and all went well (had to flash via USB to serial as tuya-convert would not work). However, I can’t seem to get the device to talk to the hardware to control it; I’ve read quite a few things and it sounds like maybe I cannot use UART, so is there another option or am I doing this incorrectly?

My config

Note: I have the same chip as noted in this article, and even followed this for reference: Controlling an Electriq iQool AC with ESPHome and Home Assistant

esp8266:
  board: esp_wroom_02

uart:
  rx_pin: GPIO13
  tx_pin: GPIO15
  baud_rate: 9600
  debug:
    direction: BOTH
    sequence:
      - lambda: UARTDebug::log_hex(direction, bytes, ' ');

tuya:

# climate:
#   - platform: tuya
#     name: Space Heater
#     id: atomi
#     supports_heat: true
#     reports_fahrenheit: true
#     switch_datapoint: 1
#     target_temperature_datapoint: 2
#     current_temperature_datapoint: 3
#     active_state:
#       datapoint: 102
#       heating_value: 1
#     swing_mode:
#       horizontal_datapoint: 104
#     preset:
#       eco:
#         datapoint: 5
#         temperature: 60

Logs

[03:16:46][I][app:100]: ESPHome version 2025.4.1 compiled on Apr 30 2025, 03:15:50
[03:16:46][C][wifi:600]: WiFi:
[03:16:46][C][wifi:428]:   Local MAC: <REDACTED>
[03:16:46][C][wifi:433]:   SSID: [redacted]
[03:16:46][C][wifi:436]:   IP Address: <REDACTED>
[03:16:46][C][wifi:439]:   BSSID: [redacted]
[03:16:46][C][wifi:441]:   Hostname: 'space-heater'
[03:16:46][C][wifi:443]:   Signal strength: -57 dB ▂▄▆█
[03:16:46][V][wifi:445]:   Priority: 0.0
[03:16:46][C][wifi:447]:   Channel: 6
[03:16:46][C][wifi:448]:   Subnet: <REDACTED>
[03:16:46][C][wifi:449]:   Gateway: <REDACTED>
[03:16:46][C][wifi:450]:   DNS1: <REDACTED>
[03:16:46][C][wifi:451]:   DNS2: <REDACTED>
[03:16:46][C][logger:177]: Logger:
[03:16:46][C][logger:178]:   Max Level: VERY_VERBOSE
[03:16:46][C][logger:179]:   Initial Level: VERY_VERBOSE
[03:16:46][C][logger:181]:   Log Baud Rate: 0
[03:16:46][C][logger:182]:   Hardware UART: UART0
[03:16:46][C][uart.arduino_esp8266:118]: UART Bus:
[03:16:46][C][uart.arduino_esp8266:119]:   TX Pin: GPIO15
[03:16:46][C][uart.arduino_esp8266:120]:   RX Pin: GPIO13
[03:16:46][C][uart.arduino_esp8266:122]:   RX Buffer Size: 256
[03:16:46][C][uart.arduino_esp8266:124]:   Baud Rate: 9600 baud
[03:16:46][C][uart.arduino_esp8266:125]:   Data Bits: 8
[03:16:46][C][uart.arduino_esp8266:126]:   Parity: NONE
[03:16:46][C][uart.arduino_esp8266:127]:   Stop bits: 1
[03:16:46][C][uart.arduino_esp8266:129]:   Using hardware serial interface.
[03:16:46][C][captive_portal:089]: Captive Portal:
[03:16:46][C][mdns:116]: mDNS:
[03:16:46][C][mdns:117]:   Hostname: space-heater
[03:16:46][V][mdns:118]:   Services:
[03:16:46][V][mdns:120]:   - _esphomelib, _tcp, 6053
[03:16:46][V][mdns:122]:     TXT: version = 2025.4.1
[03:16:46][V][mdns:122]:     TXT: mac = <REDACTED>
[03:16:46][V][mdns:122]:     TXT: platform = ESP8266
[03:16:46][V][mdns:122]:     TXT: board = esp_wroom_02
[03:16:46][V][mdns:122]:     TXT: network = wifi
[03:16:46][V][mdns:122]:     TXT: api_encryption = <REDACTED>
[03:16:46][C][esphome.ota:073]: Over-The-Air updates:
[03:16:46][C][esphome.ota:074]:   Address: space-heater.local:8266
[03:16:46][C][esphome.ota:075]:   Version: 2
[03:16:46][C][esphome.ota:078]:   Password configured
[03:16:46][C][safe_mode:018]: Safe Mode:
[03:16:46][C][safe_mode:019]:   Boot considered successful after 60 seconds
[03:16:46][C][safe_mode:021]:   Invoke after 10 boot attempts
[03:16:46][C][safe_mode:022]:   Remain in safe mode for 300 seconds
[03:16:46][C][api:140]: API Server:
[03:16:46][C][api:141]:   Address: space-heater.local:6053
[03:16:46][C][api:143]:   Using noise encryption: YES
[03:16:46][C][tuya:041]: Tuya:
[03:16:46][C][tuya:044]:   Initialization failed. Current init_state: 0
[03:16:46][C][tuya:049]:   If no further output is received, confirm that this is a supported Tuya device.
[03:16:50][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[03:16:50][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[03:16:51][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[03:16:51][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[03:16:51][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[03:16:51][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[03:16:51][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[03:16:51][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[03:16:52][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[03:16:52][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[03:16:52][E][tuya:464]: Initialization failed at init_state 0

I am able to hit the physical buttons and see some data in the logs pop up and even played with turning on the device which sporadically works with this snippet as I was seeing this string when hitting the on button: F2:F2:02:10:01:01:02:02:00:02:04:3C:01:01:3D:01:02:00:01:9D:7E:

 switch:
   - platform: template
     id: "power_heater"
     name: "Power_Heater"
     turn_on_action:
       - uart.write: [0xF2, 0xF2, 0x02, 0x10, 0x01, 0x01, 0x02, 0x02, 0x00, 0x02, 0x04, 0x3C, 0x01, 0x01, 0x3D, 0x01, 0x02, 0x00, 0x01, 0x9D, 0x7E]

I have same issue. looks like this command is not supported on tuya.
Actually i ignore it, but for sure need to be fixed.
I sniff original tuya init, and it’s looks like this:

script:
  - id: tuya_kick
    then:
      # Wi-Fi state (these are exactly from your reply stream)
      - uart.write:                # state = 0
          id: mcu_uart
          data: [0x55,0xAA,0x00,0x03,0x00,0x01,0x00,0x03]
      - delay: 80ms
      - uart.write:                # state = 2
          id: mcu_uart
          data: [0x55,0xAA,0x00,0x03,0x00,0x01,0x02,0x05]
      - delay: 80ms
      - uart.write:                # state = 3
          id: mcu_uart
          data: [0x55,0xAA,0x00,0x03,0x00,0x01,0x03,0x06]
      - delay: 120ms
      # Query product info
      - uart.write:
          id: mcu_uart
          data: [0x55,0xAA,0x00,0x01,0x00,0x00,0x00]
      - delay: 120ms
      # Query all DP status
      - uart.write:
          id: mcu_uart
          data: [0x55,0xAA,0x00,0x08,0x00,0x00,0x07]

button:
  - platform: template
    name: "Kick Tuya Handshake"
    on_press:
      - script.execute: tuya_kick

I was hoping this would work for me but didn’t seem to do anything :frowning:

[18:50:28][D][button:010]: 'Kick Tuya Handshake' Pressed.
[18:50:28][D][uart_debug:114]: >>> 55 AA 00 03 00 01 00 03 55 AA 00 03 00 01 02 05 55 AA 00 03 00 01 03 06
[18:50:28][D][uart_debug:114]: >>> 55 AA 00 01 00 00 00
[18:50:28][D][uart_debug:114]: >>> 55 AA 00 08 00 00 07
[18:50:40][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[18:50:40][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[18:50:40][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[18:50:40][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[18:50:40][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[18:50:41][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[18:50:41][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[18:50:41][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[18:50:41][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[18:50:41][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[18:50:41][E][tuya:464]: Initialization failed at init_state 0

I assume I would need to put my original firmware back on and then sniff the init from that? How did you go about sniffing the init?

Hello,
I assume yes, you need to put your original firmware, and sniff uart send/receive. then you see what exctly is sending and receiving from device.

Ed

I wonder if this uses the low power protocol even if it isn’t never shutdown. Have you tried the low power pull request available on GitHub?

Edit: Tuya low-energy wi-fi devices support by SaschaKP · Pull Request #8953 · esphome/esphome · GitHub

Hello, I have a similar issue. I am able to communicate with the tuyaMCU using openbeken on the same hardware. The magic command that makes it work on openbeken is tuyaMcu_defWiFiState 4.
How to replicate this in esphome? I tried manually writing to uart on boot but no dice. Esphome keeps on sending CMD=0x00 VERSION=0 DATA=[ ] INIT_STATE=0. We need to set wifi state to 4 for the tuyaMCU to respond.

So INIT_STATE has to be configured to send INIT_STATE=4? If that is the case, then wondering if a feature request for tuyaMCU can be submitted.

This PR seems to do exactly this but was not merged.

Ahh bummer…will see if I can utilize that branch to even test it out…if it does work then yeah bummer it isn’t being pulled in

Using esphome version 2025.7.3 solved it for me. Later version of esphome are broken (as of now). Hope this helps somebody having similar issue.

Unfortunately doesn’t seem like my heater falls into that situation, tried that July 2025 version and same thing:

[15:45:32][V][mdns:126]:   Services:
[15:45:32][V][mdns:128]:   - _esphomelib, _tcp, 6053
[15:45:32][V][mdns:131]:     TXT: version = 2025.7.5
[15:45:32][V][mdns:131]:     TXT: mac = <REDACTED>
[15:45:32][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[15:45:32][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[15:45:33][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[15:45:33][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[15:45:33][V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[15:45:33][D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
[15:45:33][E][tuya:464]: Initialization failed at init_state 0

I am pretty sure it is tied to something extra I have to do to get a handshake going, so need to restore the old firmware and sniff the traffic