ESP Haier: Haier Air Conditioner + ESP Home + Wemos D1 mini


This is the chip inside the Haier!

@Knol010, i have the same esp32 in my unit. I have tried to connect Wemos without success. I will try Albeta version today and let you know.

@MiguelAngelLV Is there any way to sniff communication between new ESP32 and AC unit and include suuport in your version?

1 Like

@snoffy from ESPHome Logs you can see the data received from AC.

The problem is that AC works by ā€œpollā€, so, if the Esp donā€™t sent the correct poll, the AC donā€™t send response.

The only way to get the correct poll is sniff the data from original Haier module

@MiguelAngelLV now it is working using your code. I make mistake by not using baud_rate in yaml. But there is another problem - using ESP there is always purify mode turned on. The same problem occurs in albeta version. Is there any way to permanently disable purify or fresh mode?

The code receives the status from AC, modify and send again to AC.

Maybe, the purifier mode is on in te received status and, when I return to AC, is enable.

You can see the log data from AC. Turn on from remote, copy the bytes to txt, enable purier and compare the bytes to localize the purifier mode and adapt the code.

Repeat again from ESP to see the diferences.

Maybe, you have a special byte or distinct modes codecs

Yes, codes are different:

From ESP:

[12:23:16][D][Haier:152]: Readed message: 255 255 42 64 0 0 0 0 0 2 109 1 7 8 37 0 2 3 0 6 0 12 49 0 88 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 177 246 22

The same settings from remote without purify turned on:

[12:23:26][D][Haier:152]: Readed message: 255 255 42 64 0 0 0 0 0 2 109 1 7 2 37 0 2 1 0 0 0 0 49 0 88 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 149 20 67

I thing this byte is purify mode:

255 255 42 64 0 0 0 0 0 2 109 1 7 8 37 0 2 3 0 6 0 12 49 0 88 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 177 246 22

The 12 in the 23 position (22 with 0 index) is the unknown mode.

In my code, the modes are 0, 1, 2, 3 or 4, but you get a 12ā€¦ Are you sure that these frame is from ESP command?

Sorry, it was my mistake - i have make to many compliation, and this log was from albeta version. It looks like your version is still not working with my unit. If you need i can sniff my unit.

1 Like

I just got an Haier Tundra plus with the e32 module as well. Tried both the haier.h versions (original and fork) without any luckā€¦ Are there any updates on this? Sadly Iā€™m not advanced enough to work on the code/parsing itself, but I might be able to provide some information.

thanks!

Show you USB - Esp connection and the ESPHome logs

hi @MiguelAngelLV .
Thanks for your reply!

Iā€™ve connected the ESP according to your instructions & already tried switching TX & RX, that didnā€™t change anything.
Here are some logs you might be interested in:

[15:09:53][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:09:58][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:10:03][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:10:08][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:10:11][D][climate:009]: ā€˜airco-zolderā€™ - Setting
[15:10:11][D][climate:013]: Mode: COOL
[15:10:11][D][Control:202]: Control call
[15:10:11][D][Control:208]: *call.get_mode() = 2
[15:10:11][D][Haier:278]: Sended message: 255 255 12 64 0 0 0 0 0 1 93 1 0 1 172 189 251 - CRC: AC - CRC16: BDFB
[15:10:12][D][Haier:278]: Sended message: 255 255 20 64 0 0 0 0 0 1 96 1 0 8 37 0 2 3 0 6 0 12 250 36 160 - CRC: FA - CRC16: 24A0
[15:10:12][D][climate:369]: ā€˜airco-zolderā€™ - Sending state:
[15:10:12][D][climate:372]: Mode: COOL
[15:10:12][D][climate:392]: Current Temperature: nanĀ°C
[15:10:12][D][climate:398]: Target Temperature: 22.00Ā°C
[15:10:13][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:10:18][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:10:21][D][climate:009]: ā€˜airco-zolderā€™ - Setting
[15:10:21][D][climate:013]: Mode: OFF
[15:10:21][D][Control:202]: Control call
[15:10:21][D][Control:208]: *call.get_mode() = 0
[15:10:21][D][Haier:278]: Sended message: 255 255 12 64 0 0 0 0 0 1 93 1 0 0 171 125 58 - CRC: AB - CRC16: 7D3A
[15:10:21][D][climate:369]: ā€˜airco-zolderā€™ - Sending state:
[15:10:21][D][climate:372]: Mode: OFF
[15:10:21][D][climate:392]: Current Temperature: nanĀ°C
[15:10:21][D][climate:398]: Target Temperature: 22.00Ā°C
[15:10:23][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180
[15:10:28][D][Haier:128]: POLL: 255 255 10 64 0 0 0 0 0 1 77 1 153 179 180

The POLL doesnā€™t seem to change when I give a command, Iā€™m assuming the AC isnā€™t able to recognize it?

I think you donā€™t received response messagesā€¦ Maybe the GPIOā€™s there arenā€™t valid for you ESP32 board or your AC use other protocol.

I have the same module. I assume the right course of action would be to try and sniff the communication between the original ESP32 module and the conditioner, force a poll and send a few commands through the HON app to see what happens?

With module? ESP board or Haier module?

I use a Wemos D1 board based in ESP8266 (not 32).

I have the original ESP32-for-Haier module on my AC, I havenā€™t yet tried connecting any other ā€œhomemadeā€ versions. I can connect a logic analyzer and provide logs if itā€™ll help in finding out how the original module communicates with the AC.

I donā€™t know what is ā€œoriginal ESP32-for-Haier moduleā€. I only know the kzw-w001 and kzw-w002

This project is for a homemade replacement of kzw-w001 or 2. I donā€™t know if it works with others.

Hello everyone, I also own a Tundra Plus unit with the ESP32-for-haier module.
Maybe it is not possible to communicate because the tx and the rx are shifted to 5V?
Unfortunately I donā€™t have an oscilloscope.

Greetings.

Scroll up, thereā€™s a new module theyā€™re shipping with recent AC models. I have a logic analyzer and Iā€™ll try to see what that new module does.

I havenā€™t had time to do an analysis with the AC connected, but the ESP32-for-Haier itself provides some valuable info. The TXD0 serves as a debug port at 115200, whereas MCU_TX communicates with the AC at 9600.
Hereā€™s a truncated debug port boot log:

Jun  8 2016 00:22:57

 rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
 configsip: 0, SPIWP:0xee
 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
 mode:DIO, clock div:2
 load:0x3fff0018,len:4
 load:0x3fff001c,len:600
 load:0x40078000,len:9076
 load:0x40080400,len:5168
 entry 0x40080648
 ;+Śšj%(536) cpu_start: cpu freq: 80
 I (536) cpu_start: Pro cpu up.
 I (536) cpu_start: Application information:
 I (537) cpu_start: Project name:     esp-idf
 I (542) cpu_start: App version:      1f794c834
 I (547) cpu_start: Compile time:     Apr 18 2021 20:49:15
 I (553) cpu_start: ELF file SHA256:  aaa6972fd7d3769c...
 I (559) cpu_start: ESP-IDF:          v3.3.5
 I (564) cpu_start: Single core mode
 I (568) heap_init: Initializing. RAM available for dynamic allocation:
 I (575) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
 I (581) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
 I (587) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
 I (594) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
 I (600) heap_init: At 3FFCCB28 len 000134D8 (77 KiB): DRAM
 I (606) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
 I (612) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
 I (618) heap_init: At 4009E118 len 00001EE8 (7 KiB): IRAM
 I (624) cpu_start: Pro cpu start user code
 j%(643) cpu_start: Starting scheduler on PRO CPU.

 app_main --- APPLICATION START ---
 RBJwifi driver task: 3ffcfa20, prio:23, stack:3584, core=0
 I (679) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
 I (679) system_api: Base MAC address is not set, read default base MAC address from BLK0 gf EFUSE
 I (689) wifi:wifi firmware version: dc30037
 I (689) wifi:config NVS flash: disabled
 I (699) wifi:config nano formating: disabled
 I (699) wifi:Init data frame dynamic rx buffer num: 32
 I (709) wifi:Init management frame dynamic rx buffer num: 32
 I (709) wifi:Init management short buffer num: 32
 I (719) wifi:Init dynamic tx buffer num: 32
 I (719) wifi:Init static rx buffer size: 1600
 I (719) wifi:Init static rx buffer num: 2
 I (729) wifi:Init dynamic rx buffer num: 32
 I (729) wifi_init: rx ba win: 4
 I (729) wifi_init: tcpip mbox: 32
 I (739) wifi_init: udp mbox: 6
 I (739) wifi_init: tcp mbox: 6
 I (749) wifi_init: tcp tx win: 5744
 I (749) wifi_init: tcp rx win: 5744
 I (749) wifi_init: tcp mss: 1436
 I (759) wifi_init: WiFi IRAM OP enabled
 I (759) wifi_init: WiFi RX IRAM OP enabled
 I (769) wifi_init: LWIP IRAM OP enabled
 I (779) uart: queue free spaces: 20
 I (779) epp_parser_map: epp_parser_state.downloaded = 1
 I (779) epp_parser_map: Mapped partition to data memory address 0X3f400000
 I (789) epp_parser_map: free heap = 196592
 I (789) epp_parser_map: Mapped partition to data memory address 0x3f448000
 I (799) epp_parser_map: map partition -> free heap = 196568
 1mE (809) uplus_sys_res_area_get_size:
 E (809) uplus_sys_res_area_read: offset = 0, len = 256
 E (819) uplus_sys_res_area_write: offset = 0, len = 256
 I (819) uplus_sys_res_area_write: 0x3ffb4e18   00 00 00 00 73 6f 68 75  00 00 00 00 00 00 00 00  |....sohu........|
 I (839) uplus_sys_res_area_write: 0x3ffb4e28   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (849) uplus_sys_res_area_write: 0x3ffb4e38   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (859) uplus_sys_res_area_write: 0x3ffb4e48   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (869) uplus_sys_res_area_write: 0x3ffb4e58   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (879) uplus_sys_res_area_write: 0x3ffb4e68   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (889) uplus_sys_res_area_write: 0x3ffb4e78   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (899) uplus_sys_res_area_write: 0x3ffb4e88   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (909) uplus_sys_res_area_write: 0x3ffb4e98   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (919) uplus_sys_res_area_write: 0x3ffb4ea8   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (929) uplus_sys_res_area_write: 0x3ffb4eb8   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (949) uplus_sys_res_area_write: 0x3ffb4ec8   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (959) uplus_sys_res_area_write: 0x3ffb4ed8   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (969) uplus_sys_res_area_write: 0x3ffb4ee8   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (979) uplus_sys_res_area_write: 0x3ffb4ef8   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 I (989) uplus_sys_res_area_write: 0x3ffb4f08   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 [347]: uplus_epp_init - start serial connection
 uplug_conf_epp_data_get called
 [354]: uplug_epp_module_init - called
 E (1009) uplus_sys_res_area_write: offset = 16, len = 8
 I (1019) uplus_sys_res_area_write: 0x3ffb4e28   00 00 00 00 00 00 00 00                           |........|
 E (1029) uplus_sys_res_area_write: offset = 0, len = 8
 I (1029) uplus_sys_res_area_write: 0x3ffb4e18   02 00 00 00 73 6f 68 75                           |....sohu|
 [UHomeOS][I][391]: dev_main is 255 dev_minor is 255 dev_dedicated is 0000000000000
 ]}}Ķ•}Õ±Ńcalled
 [UHomeOS][LOG][422]: uplugSDK e++ init ok
 [422]: uplus_epp_access_register - called
 [422]: uplus_epp_access_register - params check pass
 [425]: uplug_epp_access_init - called - access method 0
 [430]: uplug_epp_access_init - init serial access struct
 [435]: uplug_epp_access_init - call init method
 +Śšj%(1109) CDM_Manager__Initialize: discovery configuration : key = eepromName, value = 00000000
 I (1119) CDM_Manager__Initialize: discovery configuration : key = acuVersion, value = 06.26.00
 I (1119) CDM_Manager__Initialize: discovery configuration : key = serialNumber, value = 999999992048011665
 I (1129) CDM_Manager__Initialize: discovery configuration : key = fwVersion, value = 4.0.0
 W (1139) uplus_sys_serial_open: esp_vfs_dev_uart_use_driver
 I (1149) CDM_Manager__Initialize: discovery configuration : key = eepromName, value = 00000000
 I (1159) CDM_Manager__Initialize: discovery configuration : key = lang, value = it-IT
 I (1169) CDM_Manager__Initialize: discovery configuration : key = chipset, value = ESP32D0WDQ5
 I (1169) CDM_Manager__Initialize: discovery configuration : key = acuVersion, value = 06.26.00
 I (1179) CDM_Manager__Initialize: discovery configuration : key = eppParserSet, value = 1

 app_main --- APPLICATION INIT COMPLETED ---

 Firmware version : IOTFW_EPP_04_00


 ----------------------- READ CERTIFICATE DATA


 *********************** host-address

 a30f6tqw0oh1x0-ats.iot.eu-west-1.amazonaws.com


 *********************** host-port

 8883


 *********************** thing-name

 c4-dd-57-45-73-74


 *********************** serial-number

 999999992048011665

 I (1229) LowPower__SleepHandler: Init low power state machine
 ;[UHomeOS][D][5131]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 61 00 07 72
 [UHomeOS][I][5132]: [UART] tx [cmd 0x61 len = 10, 13] ret 13
 [UHomeOS][D][5441]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 61 00 07 72
 [UHomeOS][I][5442]: [UART] tx [cmd 0x61 len = 10, 13] ret 13
 [UHomeOS][D][5751]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 61 00 07 72
 [UHomeOS][I][5752]: [UART] tx [cmd 0x61 len = 10, 13] ret 13
 ;ź««=Mum1=um061]: e++ comm time: 930
 ź««=Mum]um161]: get ver timeout
 [UHomeOS][I][6162]: dev_main is 255 dev_minor is 255 dev_dedicated is 0000000000000
 _ź««=Mum%um191]: e++ state from ver to typeid
 _[UHomeOS][D][6271]: tx serial e++ data
 ff ff 08 00 00 00 00 00 00 70 78
 [UHomeOS][I][6272]: [UART] tx [cmd 0x70 len = 8, 11] ret 11
 [UHomeOS][D][6581]: tx serial e++ data
 ff ff 08 00 00 00 00 00 00 70 78
 [UHomeOS][I][6582]: [UART] tx [cmd 0x70 len = 8, 11] ret 11
 [UHomeOS][D][6891]: tx serial e++ data
 ff ff 08 00 00 00 00 00 00 70 78
 [UHomeOS][I][6892]: [UART] tx [cmd 0x70 len = 8, 11] ret 11
 ź««=Mum1=um201]: e++ comm time: 930
 ź««=Mum]um721]: get typeid timeout
 [UHomeOS][I][7722]: dev_main is 255 dev_minor is 255 dev_dedicated is 0000000000000
 ź««=Mum%um751]: e++ state from typeid to status
 [UHomeOS][D][7891]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][7892]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 [UHomeOS][D][8201]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][8202]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 [UHomeOS][D][8512]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][8512]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 [UHomeOS][D][8821]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][8822]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 ?[UHomeOS][D][9131]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][9132]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 [UHomeOS][D][9441]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][9442]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 [UHomeOS][D][9751]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][9752]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 _[UHomeOS][D][10061]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][10062]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 ;[UHomeOS][D][10371]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 01 4d 01 59
 [UHomeOS][I][10372]: [UART] tx [cmd 0x01 len = 10, 13] ret 13
 ź««=Mum1=um0681]: e++ comm time: 2790
 ź««=Mum]um0841]: get status timeout
 [UHomeOS][I][10842]: dev_main is 255 dev_minor is 255 dev_dedicated is 0000000000000
 [UHomeOS][D][10891]: tx serial e++ data
 ff ff 0a 00 00 00 00 00 00 61 00 07 72
 [UHomeOS][I][10892]: [UART] tx [cmd 0x61 len = 10, 13] ret 13
 uplus_dev_status called 0
 ź««=Mum]um1201]: serial device closed

Sometime next week Iā€™ll do a dump while connected to the AC. If anyoneā€™s interested in raw dumps (Saleae Logic or Pulseview), just ask.

I may be very wrong here, but doesnā€™t the usb connect with a simple uart with the aircon? It could work with the midea way
Bad thing is on my parents house the Haier doesnā€™t have a usb slot, so Iā€™ll have to check the main board for pins to connect