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

@paveldn do you need some protocol settings for smartAir2 found out? I will probably have time over weekend to play with this.

Winter is coming and my AC is pretty much my only source of heat so having some better control over it this year is super welcomed by me :smiley:

I guess:

  • beeper
  • beeper from app (if possible)
  • display
  • airflow positions
  • maybe swing
  • maybe follow/avoid people

Would format like this be ok

00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 10 00 00 00 08 8B #pos 31 - display on, health (ion) ON, healt airflow down (vertical position most bottom)
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 30 00 00 00 08 AB #pos 31 - display off, health (ion) ON, healt airflow down (vertical position most bottom)
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 30 00 00 00 08 AB #
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 09 00 08 00 00 00 08 73 #pos 31, pos 29 - display on, healt airflow up, health (ion) ON
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 08 00 00 00 08 83 #
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 08 00 00 00 08 6C #
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 08 00 00 00 08 6C #pos 29 health (ion) off, display on, healt airflow up
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 09 00 08 00 00 00 08 74 #pos 29 health (ion) on, display on, healt airflow up
FF FF 22 00 00 00 00 00 01 02 6D 01 00 1A 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 00 00 00 00 08 7E #pos 29, pos 31 -  health (ion) on, display on, healt airflow not set
FF FF 22 00 00 00 00 00 01 02 6D 01 00 19 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 65 #pos 29, pos 31 -  health (ion) off, display on, healt airflow not set, v airflow most down, h airflow mid
FF FF 22 00 00 00 00 00 01 02 6D 01 00 16 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 72 #pos 13, 29? - v airflow most down, h airflow left
FF FF 22 00 00 00 00 00 01 02 6D 01 00 16 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 72 #pos 13 - v airflow most down, h airflow left-mid
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 63 #pos 13 - v airflow most down, h airflow left-mid
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #pos 13 - v airflow most down, h airflow right-mid
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #pos 13, 29? - v airflow most down, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow down-mid, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #- v airflow down-mid, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #- v airflow mid, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #- v airflow mid, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow mid, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow up-mid, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow up, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow up, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow down, h airflow right
FF FF 22 00 00 00 00 00 01 02 6D 01 00 18 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow down, h airflow right - after on-off
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 73 #- v airflow down, h airflow right - after on-off
FF FF 22 00 00 00 00 00 01 02 6D 01 00 17 00 2D 00 7F 00 00 00 00 00 02 00 03 00 02 00 01 00 00 00 00 00 08 66 #pos 26 - h airflow - switng
FF FF 22 00 00 00 00 00 01 02 6D 01 00 16 00 2C 00 7F 00 00 00 00 00 02 00 03 00 03 00 11 00 00 00 00 00 08 75 #pos 26 - h airflow - switng, v airflow swing
FF FF 22 00 00 00 00 00 01 02 6D 01 00 16 00 2C 00 7F 00 00 00 00 00 02 00 03 00 01 00 01 00 00 00 00 00 08 63 #pos 26 - v airflow swing, h airflow most left

(i can’t figure out the vertical position bits)

positions according to haier_packet.h

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 10 00 00 00 08 8B #pos 27 - display on, health (ion) ON, healt airflow down (vertical position most bottom)
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 30 00 00 00 08 AB #pos 27 - display off, health (ion) ON, healt airflow down (vertical position most bottom)
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 30 00 00 00 08 AB #
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 09 00 08 00 00 00 08 73 #pos 27, pos 25 - display on, healt airflow up, health (ion) ON
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 08 00 00 00 08 83 #
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 08 00 00 00 08 6C #
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 08 00 00 00 08 6C #pos 27 health (ion) off, display on, healt airflow up
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 09 00 08 00 00 00 08 74 #pos 27 health (ion) on, display on, healt airflow up
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 19 00 00 00 00 00 08 7E #pos 27, pos 31 -  health (ion) on, display on, healt airflow not set
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 65 #pos 27, pos 31 -  health (ion) off, display on, healt airflow not set, v airflow most down, h airflow mid
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 72 #pos 13, 25? - v airflow most down, h airflow left
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 72 #- v airflow most down, h airflow left-mid
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 63 #- v airflow most down, h airflow left-mid
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow most down, h airflow right-mid
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #25? - v airflow most down, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow down-mid, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #- v airflow down-mid, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #- v airflow mid, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 74 #- v airflow mid, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow mid, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow up-mid, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow up, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow up, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow down, h airflow right
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 01 00 00 00 00 00 08 64 #- v airflow down, h airflow right - after on-off
2C 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 00 00 00 00 08 73 #- v airflow down, h airflow right - after on-off
2D 00 7F 00 00 00 00 00 02 00 03 00 02 00 01 00 00 00 00 00 08 66 #pos 23 - h airflow - switng
2C 00 7F 00 00 00 00 00 02 00 03 00 03 00 11 00 00 00 00 00 08 75 #pos 23 - h airflow - switng, v airflow swing
2C 00 7F 00 00 00 00 00 02 00 03 00 01 00 01 00 00 00 00 00 08 63 #pos 23 - v airflow swing, h airflow most left

my findings are probably wrong as ie. i identified swing on position 23, however in haier_packet.h it is position 25, 29 - and when used from the your HA component swing works

Yes it would be a great help. Format also OK.
Thanks

I tried to crosscheck against haier_packet.h, but the placement does not align ie. something is on position 35 in my case and marked as 33 there, but still the component itself reads correct data, i think i will need to learn how to debug this to understand the bitfield, and also for the positions of the flaps, i still did not found a way ho to get/set it - i think for that it would need to be reverse engineered from the original firmware.

I do not know how to ask it so it can be understood, but can 1 bitfield position resolve into two positions of the hex coded received message?

this also does not mention what module they are using under the metal cover :slight_smile:

MK-QTWIFI-08(A) SoC module designed base on RTL8710BN-A0 chip solution it says here Qingdao Haier Technology Co., Ltd. Instructions - PDF Free Download

So I guess it would be required to connect this to the AC and try to control positions from the smarair2 app while having something connected to the serial bus listening to the communication (ESP maybe :slight_smile: ) - seems not very easy to do.

That is because unlike others I don’t take in to account first two 0xFF bytes. So if in my file it is marked as byte 10 you need to add 2 to match with your code.

No. Of course you can write a function that will do it for you it can’t be done only with bitfields. Just consider bitfields as mechanosm that helps you to interpret buffer without bit shifts etc. But not more.

That is what I doing with my Haier esp32 module. You just will need to connect to tx (to get module - > AC data) rx (to get AC - > module answers) and grnd (2 times) and connect tx grnd and rx grnd to separate ttl to usb modules (or separate esp32 modules) to listen what is happening in both directions

Well I do not know how to ask that question, so I will try again

    /* 27 */    uint8_t             ac_power:1;                 // Is ac on or off
                uint8_t             :2;
                uint8_t             health_mode:1;              // Health mode on or off
				uint8_t				compressor:1;				// Compressor on or off ???
                uint8_t             :0;
    /* 28 */    uint8_t             :8;
    /* 29 */    uint8_t             use_swing_bits:1;           // Indicate if horizontal_swing and vertical_swing should be used
				uint8_t				turbo_mode:1;				// Turbo mode
				uint8_t				silent_mode:1;				// Silent mode
				uint8_t				horizontal_swing:1;			// Horizontal swing (if swing_both == 0)
				uint8_t				vertical_swing:1;			// Vertical swing (if swing_both == 0) if vertical_swing and horizontal_swing both 0 => swing off
				uint8_t				led_on_off:1;	
uint8_t				:0;

This will always result in hex

01 02 ff

and it can’t ever be

01 02 ef 04

?
values are just example, obviously it reality it will be different just the number of … bits :slight_smile:

Since I’m using the haier “usb” cable to connect to the ACs I will just do the usb splitter to sniff out the rx tx communication. With the hON there is no fake usb, oo that is less confusing even, but i went and kept the the fake usbs and added them to hON units even.
But even now I already know it will take me long time to get to it.

1 Like

No, not really. Let me get home (which will happen next Wednesday) and I will write big post with explanation how to use bitfields. It is difficult to do from the phone.

1 Like

Hi,
Can somebody with smartAir2 AC check the changes I implemented? It is on the dev branch now GitHub - paveldn/esphome-smartAir2 at dev
What is new:

  1. Code refactored to be more similar to hOn code.
  2. Added beeper and display switch (similar to the same switches in hOn)

Let me know if it worked or not.

Beeper does not work - beeps even if it is set to OFF, display does turn off/on correctly.
Basic operations like set temps or modes work ok.

I have ordered HW to make the UART sniffer, not from ali, but it will still take a while to get here. Unfortunately, there is no option for the beeper on the remote I have, but i will try to look for in the smartAir2 app once I have UART sniffer setup.

Can you provide me a log with a couple of on/off?

Thanks, that will help.

I don’t think it will be any help it seem that controlling beeper actually crashes the esp adapter

21:05:43	[D]	[switch:013]	
'AC obývák beeper' Turning ON.
21:05:43	[D]	[switch:037]	
'AC obývák beeper': Sending state ON
21:05:44	[D]	[Haier:398]	
Message sent: FF FF 0A 00 00 00 00 00 01 01 4D 01 5A
21:05:44	[D]	[Haier:533]	
HVAC Mode = 0x2
21:05:44	[D]	[Haier:534]	
Fan speed Status = 0x3
21:05:44	[D]	[Haier:535]	
Set Point Status = 0x4
21:05:44	[D]	[climate:385]	
'AC obývák' - Sending state:
21:05:44	[D]	[climate:385]	
'AC obývák' - Sending state:
21:05:44	[D]	[climate:388]	
  Mode: HEAT
21:05:44	[D]	[climate:393]	
  Fan Mode: AUTO
21:05:44	[D]	[climate:405]	
  Swing Mode: VERTICAL
21:05:44	[D]	[climate:408]	
  Current Temperature: 21.00°C
21:05:44	[D]	[climate:408]	
  Current Temperature: 21.00°C
21:05:44	[D]	[climate:414]	
  Target Temperature: 20.00°C
21:05:44	[D]	[Haier:377]	
Received Poll command answer message during phase 4, size: 35, content: FF FF 22 00 00 00 00 00 01 02 6D 01 00 15 00 29 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 14 00 00 00 04 7E
21:05:49	[D]	[Haier:398]	
Message sent: FF FF 0A 00 00 00 00 00 01 01 4D 01 5A
21:05:49	[D]	[Haier:533]	
HVAC Mode = 0x2
21:05:49	[D]	[Haier:534]	
Fan speed Status = 0x3
21:05:49	[D]	[Haier:535]	
Set Point Status = 0x4
21:05:49	[D]	[Haier:535]	
Set Point Status = 0x4
21:05:49	[D]	[climate:385]	
'AC obývák' - Sending state:
21:05:49	[D]	[climate:385]	
'AC obývák' - Sending state:
21:05:49	[D]	[climate:388]	
  Mode: HEAT
21:05:49	[D]	[climate:393]	
  Fan Mode: AUTO
21:05:49	[D]	[climate:405]	
  Swing Mode: VERTICAL
21:05:49	[D]	[climate:408]	
  Current Temperature: 21.00°C
21:05:49	[D]	[climate:414]	
  Target Temperature: 20.00°C
21:05:49	[D]	[Haier:377]	
Received Poll command answer message during phase 4, size: 35, content: FF FF 22 00 00 00 00 00 01 02 6D 01 00 15 00 29 00 7F 00 00 00 00 00 02 00 03 00 00 00 11 00 14 00 00 00 04 7E
21:05:50	[D]	[switch:017]	
'AC obývák beeper' Turning OFF.
21:05:50	[D]	[switch:017]	
'AC obývák beeper' Turning OFF.
21:05:50	[D]	[switch:037]	
'AC obývák beeper': Sending state OFF
21:05:51	[D]	[switch:013]	
'AC obývák beeper' Turning ON.
21:05:51	[D]	[switch:037]	
'AC obývák beeper': Sending state ON
21:05:53	[D]	[switch:017]	
'AC obývák beeper' Turning OFF.
21:05:53	[D]	[switch:037]	
'AC obývák beeper': Sending state OFF
21:05:54	[D]	[Haier:398]	
Message sent: FF FF 0A 00 00 00 00 00 01 01 4D 01 5A
21:05:54	[D]	[switch:013]	
'AC obývák beeper' Turning ON.
21:05:54	[D]	[switch:037]	
'AC obývák beeper': Sending state ON
21:05:54	[D]	[Haier:533]	
HVAC Mode = 0x2
21:05:54	[D]	[Haier:534]	
Fan speed Status = 0x3
21:05:54	[D]	[Haier:535]	
Set Point Status = 0x4
21:05:54	[D]	[climate:385]	
'AC obývák' - Sending state:
21:05:54	[D]	[climate:388]	
  Mode: HEAT
21:05:54	[D]	[climate:393]	
  Fan Mode: AUTO
21:05:54	[D]	[climate:405]	
  Swing Mode: VERTICAL
21:05:54	[D]	[climate:408]	
  Current Temperature: 21.00°C
21:05:54	[D]	[climate:414]	
  Target Temperature: 20.00°C

I wonder if smartair2 gen can even disable the beeper

with

climate:
  - platform: haier
    id: ${device_id}
    name: ${device_name} 
    uart_id: ${uart_id}
    beeper: false

it does not log anything and acts super weird

weel now even when i did put beeper true into the config back on i do get

[21:16:02][D][climate:414]:   Target Temperature: 20.00°C
INFO 192.168.50.216: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO 192.168.50.216: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for 192.168.50.216
WARNING Disconnected from API
INFO Successfully connected to 192.168.50.216
[21:16:17][D][Haier:398]: Message sent: FF FF 0A 00 00 00 00 00 01 01 4D 01 5A
[21:16:17][D][Haier:533]: HVAC Mode = 0x2
[21:16:17][D][Haier:534]: Fan speed Status = 0x3
[21:16:17][D][Haier:535]: Set Point Status = 0x4
[21:16:17][D][climate:385]: 'AC obývák' - Sending state:
[21:16:17][D][climate:388]:   Mode: HEAT
[21:16:17][D][climate:393]:   Fan Mode: AUTO
[21:16:17][D][climate:405]:   Swing Mode: VERTICAL
[21:16:17][D][climate:408]:   Current Temperature: 21.00°C
INFO 192.168.50.216: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO 192.168.50.216: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for 192.168.50.216
WARNING Disconnected from API
INFO Successfully connected to 192.168.50.216
[21:16:32][D][Haier:398]: Message sent: FF FF 0A 00 00 00 00 00 01 01 4D 01 5A

and it starts to become unavailable and reset in HA now

resetting the breaker for AC circuit and then setting up temperature and mode using IR remote seem to make it better but after a while ac starts beeping and esp crashing.

After reverting to the master branch i noticed that the swing mode off is read back as vertical.

Very strange behavior :frowning: . I will try to figure out what is happening there

15:53:50	[D]	[Haier:587]	
Received Init1 command answer message during phase 1, size: 49, content: FF FF 2E 40 00 00 00 00 00 62 45 2B 2B 32 2E 31 38 00 31 37 30 36 32 36 30 30 F1 00 00 31 37 30 35 32 36 30 30 01 55 2D 41 43 00 00 00 00 00 04 5B 8A AB
15:53:50	[D]	[Haier:608]	
Message sent: FF FF 08 40 00 00 00 00 00 70 B8 86 41
15:53:51	[D]	[Haier:587]	
Received Init2 command answer message during phase 3, size: 43, content: FF FF 28 40 00 00 00 00 00 71 20 08 61 08 00 82 03 24 02 12 00 11 80 05 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 91 FC D5
15:53:51	[D]	[Haier:608]	
Message sent: FF FF 0A 40 00 00 00 00 00 01 4D 01 99 B3 B4
15:53:51	[W]	[Haier:482]	
Wrong packet checksum: 0x3D07 (expected 0x553D)
15:53:56	[D]	[Haier:608]	
Message sent: FF FF 0A 00 00 00 00 00 00 61 00 07 72
15:53:56	[D]	[Haier:587]	
Received Init1 command answer message during phase 1, size: 49, content: FF FF 2E 40 00 00 00 00 00 62 45 2B 2B 32 2E 31 38 00 31 37 30 36 32 36 30 30 F1 00 00 31 37 30 35 32 36 30 30 01 55 2D 41 43 00 00 00 00 00 04 5B 8A AB
15:53:56	[D]	[Haier:608]	
Message sent: FF FF 08 40 00 00 00 00 00 70 B8 86 41
15:53:56	[D]	[Haier:587]	
Received Init2 command answer message during phase 3, size: 43, content: FF FF 28 40 00 00 00 00 00 71 20 08 61 08 00 82 03 24 02 12 00 11 80 05 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 91 FC D5
15:53:56	[D]	[Haier:608]	
Message sent: FF FF 0A 40 00 00 00 00 00 01 4D 01 99 B3 B4
15:53:56	[W]	[Haier:482]	
Wrong packet checksum: 0x3D07 (expected 0x553D)
15:54:01	[D]	[Haier:608]	
Message sent: FF FF 0A 00 00 00 00 00 00 61 00 07 72
15:54:02	[D]	[Haier:587]	
Received Init1 command answer message during phase 1, size: 49, content: FF FF 2E 40 00 00 00 00 00 62 45 2B 2B 32 2E 31 38 00 31 37 30 36 32 36 30 30 F1 00 00 31 37 30 35 32 36 30 30 01 55 2D 41 43 00 00 00 00 00 04 5B 8A AB
15:54:02	[D]	[Haier:608]	
Message sent: FF FF 08 40 00 00 00 00 00 70 B8 86 41
15:54:02	[D]	[Haier:587]	
Received Init2 command answer message during phase 3, size: 43, content: FF FF 28 40 00 00 00 00 00 71 20 08 61 08 00 82 03 24 02 12 00 11 80 05 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 91 FC D5
15:54:02	[D]	[Haier:608]	
Message sent: FF FF 0A 40 00 00 00 00 00 01 4D 01 99 B3 B4
15:54:02	[W]	[Haier:482]	
Wrong packet checksum: 0x3D07 (expected 0x553D)
15:54:07	[D]	[Haier:608]	
Message sent: FF FF 0A 00 00 00 00 00 00 61 00 07 72
15:54:07	[D]	[Haier:587]	
Received Init1 command answer message during phase 1, size: 49, content: FF FF 2E 40 00 00 00 00 00 62 45 2B 2B 32 2E 31 38 00 31 37 30 36 32 36 30 30 F1 00 00 31 37 30 35 32 36 30 30 01 55 2D 41 43 00 00 00 00 00 04 5B 8A AB
15:54:07	[D]	[Haier:608]	
Message sent: FF FF 08 40 00 00 00 00 00 70 B8 86 41
15:54:08	[D]	[Haier:587]	
Received Init2 command answer message during phase 3, size: 43, content: FF FF 28 40 00 00 00 00 00 71 20 08 61 08 00 82 03 24 02 12 00 11 80 05 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 91 FC D5
15:54:08	[D]	[Haier:608]	
Message sent: FF FF 0A 40 00 00 00 00 00 01 4D 01 99 B3 B4
15:54:08	[W]	[Haier:482]	
Wrong packet checksum: 0x3D07 (expected 0x553D)
15:54:13	[D]	[Haier:608]	
Message sent: FF FF 0A 00 00 00 00 00 00 61 00 07 72
15:54:13	[D]	[Haier:587]	
Received Init1 command answer message during phase 1, size: 49, content: FF FF 2E 40 00 00 00 00 00 62 45 2B 2B 32 2E 31 38 00 31 37 30 36 32 36 30 30 F1 00 00 31 37 30 35 32 36 30 30 01 55 2D 41 43 00 00 00 00 00 04 5B 8A AB
15:54:13	[D]	[Haier:608]	
Message sent: FF FF 08 40 00 00 00 00 00 70 B8 86 41
15:54:13	[D]	[Haier:587]	
Received Init2 command answer message during phase 3, size: 43, content: FF FF 28 40 00 00 00 00 00 71 20 08 61 08 00 82 03 24 02 12 00 11 80 05 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 91 FC D5
15:54:13	[D]	[Haier:608]	
Message sent: FF FF 0A 40 00 00 00 00 00 01 4D 01 99 B3 B4
15:54:13	[W]	[Haier:482]	
Wrong packet checksum: 0x3D07 (expected 0x553D)
15:54:18	[D]	[Haier:608]	
Message sent: FF FF 0A 00 00 00 00 00 00 61 00 07 72
15:54:18	[D]	[Haier:587]	
Received Init1 command answer message during phase 1, size: 49, content: FF FF 2E 40 00 00 00 00 00 62 45 2B 2B 32 2E 31 38 00 31 37 30 36 32 36 30 30 F1 00 00 31 37 30 35 32 36 30 30 01 55 2D 41 43 00 00 00 00 00 04 5B 8A AB
15:54:19	[D]	[Haier:608]	
Message sent: FF FF 08 40 00 00 00 00 00 70 B8 86 41
15:54:19	[D]	[Haier:587]	
Received Init2 command answer message during phase 3, size: 43, content: FF FF 28 40 00 00 00 00 00 71 20 08 61 08 00 82 03 24 02 12 00 11 80 05 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 91 FC D5
15:54:19	[D]	[Haier:608]	
Message sent: FF FF 0A 40 00 00 00 00 00 01 4D 01 99 B3 B4
15:54:19	[W]	[Haier:482]	
Wrong packet checksum: 0x3D07 (expected 0x553D)
15:54:24	[D]	[Haier:608]	

On hON ones today, no idea what could have changed.

I have looked into ESP32-S0WD-Haier/haier_climate.cpp at 2370ee2ed611f016d5c671d04a2d6bc373e7b8f3 · paveldn/ESP32-S0WD-Haier · GitHub can’t figure out why it is triggered on line 482 - how can the CRC of the received line not match.

I would really like to actually help with the dev process, but CPP is just too alien/low level to me still.

After restarting the AC it works ok, just trying to make it 100% stable.

Since I can run hON units with beeperOff it is not even big hustle to restart every week or so and after it restarts to apply mode OFF, definitely workaround, or actually even crate one more status, like error and if we get status change to error (on is valid == false) then restart the AC, so definitely work arounds are not that hard, but i’m still too perfectionist :frowning: [so that means hON or smartAir2 apps are unusable for me, OBVIOUSLY :smiley: ]

I am quite sure it is a bug on the AC side. I didn’t see this one before but I saw other (when AC stops answering or answers with a huge delay). So I am afraid there is no other way for now only restart AC from time to time.

Yes me too that is why I want to reverse code the original ESP32 firmware to see how it is dealing with these problems. Also, I hope there are commands in a protocol that is still unknown to us. Like Restart AC. OTA update for AC, etc. But I stopped it, for now, it takes too much time.

P.S. For smartAir2 I can’t find problems with the beeper off so I suppose I will remove it for now. I will publish the new code later. Published in dev branch

That is why i’m thinking if it is possible to make automation in HA that would go like this:

  • if AC state == fail [might just be AC communications fail switch set to ON] (set when ie. is valid == false)
    • then save current AC settings to variable
    • switch off
    • wait 5 seconds
    • switch on
    • when ac available
    • set mode saved in variable

At least mine ACs do no restart in last mode on power loss, but in some default like 24c cooling or something like that.

I think it is doable, guess i will look into it over the winter.

Regarding disassembly - smartAir2 Haier adapter is RTL8710BN based do you know if there is some disassembly options for their firmware?

It is an ARM processor. If you have access to Hex-Rays IDA Pro this is the best option. But of course, it is an expensive professional tool so the next option is Ghidra. It will require more “dances” but it is free and open source. Here is some video to start with https://www.youtube.com/watch?v=q4CxE5P6RUE . Any way you should have at least some basic knowledge about ARM Assembler. I can recommend you this: ARM assembler in Raspberry Pi

So I found this web 海极网-海尔智慧家庭开放平台 says haier open smart home, I do not read mandarin, not even the mao/simplified, so that does not make it easier :smiley:
this is documentation on
2.17 protocol for ac or something like that Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.
2.19 protocol? Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

but U+ is probably even something different then hON and SmartAir2 (maybe hON is still U+, so confus)

DeepL translate:
217 Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.
219 Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

But seems to be description of the protocol, right?

Hopefully it might be helpful.

Some options to maybe crosscheck

MuteStatus (Byte6:Bit4)
Buzzer echo status (echoStatus) (Byte6:Bit7)
FreshAirStatus (Byte10:Bit0)
Scenario Light Status (lightStatus) (Byte10:Bit5)
Energy saving/ECO mode status (energySavingStatus) (Byte10:Bit6)
Sleep mode switch status (silentSleepStatus) (Byte6:Bit5)
screenDisplayStatus (Byte5:Bit1)
Up and down wind (windDirectionVertical)(Byte2:Bit3~Byte2: Bit0)
Target temperature (targetTemperature) (Byte1)
0.5 degree setting function state (halfDegreeSettingStat us)(Byte5:Bit2)

So I was a little cheeky and just asked for the documentation for SmartAir2 UART protocol in a ticket.
Tuya has similar system ( iot.tuya.com ) and were surprisingly able to fix some issues that product “manufacturers” claimed are impossible. :crossed_fingers: :crossed_fingers:

1 Like

@evlo Great job. Pity, it is in mandarin only but it is definitely easier than reverse code firmware. Hope you will get the smartAir2 protocol. It would be great.
Will dig documents now :smiley:

@evlo From the protocol description, it looks like CRC in communication with AC is optional so in some cases, it can be skipped. It is indicated with a bit in the frame header. It can explain why in your case there was a CRC error in communication. AC somehow decided to skip CRC but protocol expected it and report it as wrong. And there is a huge section with all possible values reported by AC, and error codes, and an OTA update section, and some frame types that I never saw before (like network time frame)… This document is what I was looking for. We need the same for smartAir2 :smiley:

Also in the docs for MK-QTWIFI-08


so the fact that LOG is also available might some help in decoding SmartAir2 protocol.

Seems to me haier is not so much against creating third party interfaces, it is more likely just language barrier.

【海尔U+智能WIFI模块试用体验】初次使用 - ARM技术论坛 - 电子技术论坛 - 广受欢迎的专业电子论坛! maybe it should be possible to somehow connect th stick to that haigeek site, or at least it was in year 2017, any volunteers? :slight_smile: