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

That would be awesome, i have prepared esp32 that terminates with haier fake usb for testing, so then I can try both esp32 and 8266 with smart air.

Were you able to the beep and (mainly) light setting with smartair2 protocol?

Havenā€™t implemented it yet. Havenā€™t even tried. I donā€™t have those ACs just do a test version for @nikolay-mileev and wait until he tests it and gives feedback. for his response. It takes much more time than an implementation for hON models (which I have) so I usually implement features for hON devices and they transfer them to smartAir2 devices. That is why it is move slower.

Hello,

Iā€™ve been trying to flash esphome to my Wemos D1 Mini for a while now, but Iā€™m having some trouble.
My yaml file was validated and I have the Haier.h file in the same place.
These are the logs I get when trying to install:

INFO Reading configuration /config/esphome/haier.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing haier (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|-- <ArduinoJson> 6.18.5
Compiling /data/haier/.pioenvs/haier/src/esphome/components/api/api_connection.cpp.o
Compiling /data/haier/.pioenvs/haier/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/haier/.pioenvs/haier/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/haier/.pioenvs/haier/src/esphome/components/api/api_pb2_service.cpp.o

After this home assistant freezes and crashes and I have to power it off and on to get it running again.

Any help would be very much appreciated because really donā€™t know what else to try. Iā€™ve already tried most of the things on the forum and reinstalled esphome.

Check your Raspberry temperature. Maybe with compilation cpu usage get a high temperature and crash

i donā€™t know why but it doesnt work with haier lightera
itā€™s can only turning off my ac, nothing else dont 'work
what is recommended to check?
log:

Summary
INFO Reading configuration /config/esphome/haier-guestroom.yaml...
INFO Starting log output from ac-bedroom2.local using esphome API
INFO Successfully connected to ac-bedroom2.local
[22:25:25][I][app:102]: ESPHome version 2022.6.2 compiled on Aug  5 2022, 22:06:55
[22:25:25][C][wifi:491]: WiFi:
[22:25:25][C][wifi:353]:   Local MAC: A4:E5:7C:B7:D1:06
[22:25:25][C][wifi:354]:   SSID: 'SiMuS2grk'[redacted]
[22:25:25][C][wifi:355]:   IP Address: 192.168.89.184
[22:25:25][C][wifi:356]:   BSSID: DC:2C:6E:25:E0:A6[redacted]
[22:25:25][C][wifi:358]:   Hostname: 'ac-bedroom2'
[22:25:25][C][wifi:360]:   Signal strength: -45 dB ā–‚ā–„ā–†ā–ˆ
[22:25:25][C][wifi:364]:   Channel: 9
[22:25:25][C][wifi:365]:   Subnet: 255.255.255.0
[22:25:25][C][wifi:366]:   Gateway: 192.168.89.1
[22:25:25][C][wifi:367]:   DNS1: 192.168.89.1
[22:25:25][C][wifi:368]:   DNS2: 8.8.8.8
[22:25:25][C][logger:275]: Logger:
[22:25:25][C][logger:276]:   Level: DEBUG
[22:25:25][C][logger:277]:   Log Baud Rate: 0
[22:25:25][C][logger:278]:   Hardware UART: UART0
[22:25:25][C][mdns:084]: mDNS:
[22:25:25][C][mdns:085]:   Hostname: ac-bedroom2
[22:25:25][C][ota:085]: Over-The-Air Updates:
[22:25:25][C][ota:086]:   Address: ac-bedroom2.local:8266
[22:25:25][C][api:138]: API Server:
[22:25:25][C][api:139]:   Address: ac-bedroom2.local:6053
[22:25:25][C][api:143]:   Using noise encryption: NO
[22:25:28][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 
[22:25:33][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 
[22:25:38][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 
[22:25:43][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 
[22:25:48][D][climate:010]: 'Haier' - Setting
[22:25:48][D][climate:014]:   Mode: OFF
[22:25:48][D][Haier:416]: Sended message: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-3
12-92 
[22:25:48][D][Haier:416]: Sended message: 
0-0
1-0
2-0
3-0
4-0
5-0
6-0
7-0
8-0
9-1
10-77
11-95
12-0
13-0
14-0
15-0
16-0
17-0
18-0
19-0
20-0
21-0
22-0
23-0
24-0
25-0
26-0
27-0
28-0
29-0
30-0
31-0
32-0
33-0
34-0
35-9
36-0 
[22:25:48][D][climate:010]: 'Haier' - Setting
[22:25:48][D][climate:014]:   Mode: OFF
[22:25:48][D][Haier:416]: Sended message: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-3
12-92 
[22:25:48][D][Haier:416]: Sended message: 
0-0
1-0
2-0
3-0
4-0
5-0
6-0
7-0
8-0
9-1
10-77
11-95
12-0
13-0
14-0
15-0
16-0
17-0
18-0
19-0
20-0
21-0
22-0
23-0
24-0
25-0
26-0
27-0
28-0
29-0
30-0
31-0
32-0
33-0
34-0
35-9
36-0 
[22:25:48][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 
[22:25:49][D][climate:010]: 'Haier' - Setting
[22:25:49][D][climate:014]:   Mode: OFF
[22:25:49][D][Haier:416]: Sended message: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-3
12-92 
[22:25:49][D][Haier:416]: Sended message: 
0-0
1-0
2-0
3-0
4-0
5-0
6-0
7-0
8-0
9-1
10-77
11-95
12-0
13-0
14-0
15-0
16-0
17-0
18-0
19-0
20-0
21-0
22-0
23-0
24-0
25-0
26-0
27-0
28-0
29-0
30-0
31-0
32-0
33-0
34-0
35-9
36-0 
[22:25:49][D][climate:010]: 'Haier' - Setting
[22:25:49][D][climate:014]:   Mode: OFF
[22:25:49][D][Haier:416]: Sended message: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-3
12-92 
[22:25:49][D][Haier:416]: Sended message: 
0-0
1-0
2-0
3-0
4-0
5-0
6-0
7-0
8-0
9-1
10-77
11-95
12-0
13-0
14-0
15-0
16-0
17-0
18-0
19-0
20-0
21-0
22-0
23-0
24-0
25-0
26-0
27-0
28-0
29-0
30-0
31-0
32-0
33-0
34-0
35-9
36-0 
[22:25:49][D][climate:010]: 'Haier' - Setting
[22:25:49][D][climate:014]:   Mode: OFF
[22:25:49][D][Haier:416]: Sended message: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-3
12-92 
[22:25:49][D][Haier:416]: Sended message: 
0-0
1-0
2-0
3-0
4-0
5-0
6-0
7-0
8-0
9-1
10-77
11-95
12-0
13-0
14-0
15-0
16-0
17-0
18-0
19-0
20-0
21-0
22-0
23-0
24-0
25-0
26-0
27-0
28-0
29-0
30-0
31-0
32-0
33-0
34-0
35-9
36-0 
[22:25:53][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 
[22:25:58][D][Haier:131]: POLL: 
0-255
1-255
2-10
3-0
4-0
5-0
6-0
7-0
8-1
9-1
10-77
11-1
12-90 

Some models have differents protocols. Try use Albeta code: https://github.com/albetaCOM/esp-haier

@albetaCOM and @paveldn , any know if we can ā€œset the current temperatureā€?

I have conduct AC, and I want use a external bluetooth temperature sensor as current temperature and Haier use these as temperature instead internal sensor.

Other alternative can be create a ā€œfake wired controllerā€ and send the temperature as wired controller.

Any ideasĀæ?

I donā€™t think there is a way to do it through the protocol. I know that Haier ACs support getting temperature from remote control but it goes outside of ESP. I havenā€™t seen anything in logs or dumps that indicate that protocol supports it. The only way I can think of is to replace room sensor with something controlled by ESP. In the service manual that @ivoh95 provided (ESP Haier: Haier Air Conditioner + ESP Home + Wemos D1 mini - #241 by ivoh95) there is information about room sensor that has a separate connector on the board (page 40 Ambient temp. sensor and page 20) it looks like it is a simple thermistor so potentially you should be able to simulate it.

1 Like

Ive been thinking about a good way to do this, it might not be hard to throw an IR blaster (just an ir led) in the AC unit seeing as how we already have an ESP in it and transmit the room temperature that way. The issue is we would need logs of the IR remote to figure out how that IR protocol works. My AC remote does not support I-Feel, but maybe someone who has one that does can get some kind of IR logs?

Side note, i figured out what the half degree bit does, it adds 1 degree F to the current setpoint. BUT it only works when F mode is enabled. Meaning if there was a F version of the code, thats how we would be able to have 1 degree precision for the setpoint.

A digital potentiometer and the table can be the solution!

Thanks!

Hey everyone,
Iā€™d like to thank you very much for all your hard work. Iā€™m following this project for a long time already and tried it a few times over the last year. But I keep going back to the Homebridge with Android App setup for using Haier inside HA. The main reason for this is that the ESPHome version of Haier lacks the swing left/right option which I use a lot.
But over the last few weeks, Homebridge with Android app setup hasnā€™t been that stable so once again Iā€™m looking into moving towards this ESPHome setup. But I really want to have the option to activate the left+right swing on my wall AC.

Has anyone been able to implement the left/right swing? Maybe with a seperate switch that toggles the swing?

Hmm, this was a good question I had when I was working on this, the climate entity does not support all the swing modes we have. Not sure what a good way to implement this is, maybe @paveldn has some ideas? Something like a drop down menu?

Although if youā€™re using my solution, you can quickly ā€œhackā€ this in by adding some buttons to your yaml. You should modify these buttons to your needs by changing the option after the two |= lines. For a list of available options, look in the hair.h file and you will see a list of definitions of all the possible selections. You can also adjust horizontal and vertical separately.

Hopefully this solves your issue temporarily and hopefully we come up with a better long term solution.

button:
  - platform: template
    name: "Max Left Down Swing"
    on_press:
      - lambda: |-
          id(control_command)[HORIZONTAL_SWING_OFFSET] &= ~HORIZONTAL_SWING_MSK;
          id(control_command)[HORIZONTAL_SWING_OFFSET] |= HORIZONTAL_SWING_MAX_LEFT;
          id(control_command)[VERTICAL_SWING_OFFSET] &= ~VERTICAL_SWING_MSK;
          id(control_command)[VERTICAL_SWING_OFFSET] |= VERTICAL_SWING_DOWN;
          sendData(id(control_command));
  - platform: template
    name: "Max Right Up Swing"
    on_press:
      - lambda: |-
          id(control_command)[HORIZONTAL_SWING_OFFSET] &= ~HORIZONTAL_SWING_MSK;
          id(control_command)[HORIZONTAL_SWING_OFFSET] |= HORIZONTAL_SWING_MAX_RIGHT;
          id(control_command)[VERTICAL_SWING_OFFSET] &= ~VERTICAL_SWING_MSK;
          id(control_command)[VERTICAL_SWING_OFFSET] |= VERTICAL_SWING_UP;
          sendData(id(control_command));

Thank you for your reply @ivoh95!
I tried using your code from Github, but when I use that code in both esphome.yaml and Haier.h the Operation mode stays in auto and no matter what I choose nothing is happening on the AC. If I control the AC via the IR-remote, the changes are not being shown in ESPHome. There is some communication between ESPHome and the AC unit, but itā€™s not working :frowning:
So Iā€™m not sure what to do to make your code work with my AC. I have the Haier flair unit at home.

[10:14:35][D][Haier:294]: POLLING
[10:14:35][D][Haier:169]: Message sent:  255 255 10 64 0 0 0 0 0 1 77 1 153 179 180  - CRC: 153 - CRC16: B3B4 
[10:14:35][D][Haier:269]: Received Status Message:  255 255 34 64 0 0 0 0 0 2 109 1 0 24 0 48 0 127 0 0 0 0 0 3 0 2 0 0 0 17 0 0 0 0 0 8 
[10:14:35][D][Debug:356]: HVAC Mode = 0x0
[10:14:35][D][Debug:357]: Fan speed Status = 0x0
[10:14:35][D][Debug:358]: Horizontal Swing Status = 0x0
[10:14:35][D][Debug:359]: Vertical Swing Status = 0x8
[10:14:35][D][Debug:360]: Set Point Status = 0x0
[10:14:35][D][climate:385]: 'Airco woonkamer' - Sending state:
[10:14:35][D][climate:388]:   Mode: AUTO
[10:14:35][D][climate:399]:   Preset: ECO
[10:14:35][D][climate:405]:   Swing Mode: OFF
[10:14:35][D][climate:408]:   Current Temperature: 0.00Ā°C
[10:14:35][D][climate:414]:   Target Temperature: 16.00Ā°C

Do any other versions work with the same hardware? To eliminate the possibility of a wiring issue, I know a lot of people have mentioned needing to use level shifters

When using the version of @MiguelAngelLV, the Haier AC works fine. I can set the mode, fan speed, fan horizontal/vertical, health mode, etc.
So basically, what Iā€™m looking for is a switch/button template to set the horizontal/left-right swing with Miguelā€™s code :smiley:

Ahh, yes it looks like thats the older/different (smartAir2) version of the protocol. I do not have such a model so i dont have any code that might work on it. @paveldn mentioned he was potentially working on such a version of his code.

1 Like

Didnā€™t really get what you want to implement. Canā€™t it be covered by standard swing modes like off, vertical, horizontal, and both?


There is no way to define custom swing mode. But it is possible to define custom presets. I think it will be the best way.

I got negative feedback from @nikolay-mileev who is testing my implementation. It looks like after some time AC stops reacting to ESP commands. ACā€™s responses are just too slow for ESP. I am checking it but didnā€™t find rootcause yet. And because I donā€™t have hardware myself it takes a long time to test all my guesses. But if there is somebody who would like to try and help me with this I can share what I have. With more help I would get easier it will be to fix. @ivoh95 as far as I get you to have AC smartAir2 AC. Is that so? Probably you can also try it. Anyway I will share my code on github later today

Yeah, the swing mode works somehow. But when I set it to horizontal itā€™ll put the flap horizontal and push air straight out while I expect the left/right swing to go left/right.
There are like two swings: the outer flap, which controls up/down airflow and the inner flaps which control the left/right airflow. This swing setting will only control the outer flap and set it in a static position. The outer flap will only move when I set it to both, then the air will flow up/down but not left/right.
I like it that I can set the outer flap horizontal or vertical, because I want it in a different position for cooling than for heating. But I also want to control the inner flaps which make the air flow left and right.

OK Thanks for the explanation. Will see what I can do.

Also as I promised my implementation for smartAir2 GitHub - paveldn/esphome-smartAir2
If you willing to test be aware of problem:

3 Likes

Iā€™ll test this out today and let you know if it works for me. Thanks Paveldn!