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

Thanks! Actually, you can help, I have a test version for smartair2 here: https://github.com/paveldn/ESP32-S0WD-Haier/tree/smartair2_test It is with a beeper switch so you can turn on/off beep feedback from AC on commands. Can you please try it and let me know if it is working fine?

Ok, I changed external_components:

  - source: 
      type: git
      url: https://github.com/paveldn/ESP32-S0WD-Haier
      ref: smartair2_test
    components: [haier]
    refresh: 1h

and added switches from .haier-smartair2-base.yaml

The switch is there, but the beep is always on, no matter how the switch is set.

[22:45:36][D][switch:013]: 'Slaapkamer Airco beeper' Turning ON.
[22:45:36][D][switch:037]: 'Slaapkamer Airco beeper': Sending state ON
[22:45:39][D][haier.protocol:019]: Sending frame: type 01, data: 4D 01
[22:45:39][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 21 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 20 00 00 00 01
[22:45:39][D][haier.climate:379]: HVAC Mode = 0x2
[22:45:39][D][haier.climate:381]: Fan speed Status = 0x0
[22:45:39][D][haier.climate:383]: Horizontal Swing Status = 0x0
[22:45:39][D][haier.climate:385]: Vertical Swing Status = 0x0
[22:45:39][D][haier.climate:387]: Set Point Status = 0x1
[22:45:44][D][haier.protocol:019]: Sending frame: type 01, data: 4D 01
[22:45:44][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 20 00 00 00 01
[22:45:44][D][haier.climate:379]: HVAC Mode = 0x2
[22:45:44][D][haier.climate:381]: Fan speed Status = 0x0
[22:45:44][D][haier.climate:383]: Horizontal Swing Status = 0x0
[22:45:44][D][haier.climate:385]: Vertical Swing Status = 0x0
[22:45:44][D][haier.climate:387]: Set Point Status = 0x1
[22:45:47][D][climate:010]: 'Slaapkamer Airco' - Setting
[22:45:47][D][climate:039]:   Target Temperature: 18.00
[22:45:47][D][Control:223]: Control call
[22:45:47][I][haier.climate:126]: Control packet sent
[22:45:47][D][haier.protocol:019]: Sending frame: type 01, data: 4D 5F 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 20 00 00 00 02
[22:45:48][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 20 00 00 00 02
[22:45:48][D][climate:385]: 'Slaapkamer Airco' - Sending state:
[22:45:48][D][climate:388]:   Mode: OFF
[22:45:48][D][climate:393]:   Fan Mode: HIGH
[22:45:48][D][climate:405]:   Swing Mode: OFF
[22:45:48][D][climate:408]:   Current Temperature: 13.00°C
[22:45:48][D][climate:414]:   Target Temperature: 18.00°C
[22:45:48][I][haier.climate:377]: HVAC values changed
[22:45:48][I][haier.climate:379]: HVAC Mode = 0x2
[22:45:48][I][haier.climate:381]: Fan speed Status = 0x0
[22:45:48][I][haier.climate:383]: Horizontal Swing Status = 0x0
[22:45:48][I][haier.climate:385]: Vertical Swing Status = 0x0
[22:45:48][I][haier.climate:387]: Set Point Status = 0x2
[22:45:49][D][haier.protocol:019]: Sending frame: type 01, data: 4D 01
[22:45:49][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 20 00 00 00 02
[22:45:49][D][haier.climate:379]: HVAC Mode = 0x2
[22:45:49][D][haier.climate:381]: Fan speed Status = 0x0
[22:45:49][D][haier.climate:383]: Horizontal Swing Status = 0x0
[22:45:49][D][haier.climate:385]: Vertical Swing Status = 0x0
[22:45:49][D][haier.climate:387]: Set Point Status = 0x2
[22:45:50][D][switch:017]: 'Slaapkamer Airco beeper' Turning OFF.
[22:45:50][D][switch:037]: 'Slaapkamer Airco beeper': Sending state OFF
[22:45:54][D][esp32.preferences:113]: Saving 2 preferences to flash...
[22:45:54][D][esp32.preferences:142]: Saving 2 preferences to flash: 1 cached, 1 written, 0 failed
[22:45:54][D][haier.protocol:019]: Sending frame: type 01, data: 4D 01
[22:45:55][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 20 00 00 00 02
[22:45:55][D][haier.climate:379]: HVAC Mode = 0x2
[22:45:55][D][haier.climate:381]: Fan speed Status = 0x0
[22:45:55][D][haier.climate:383]: Horizontal Swing Status = 0x0
[22:45:55][D][haier.climate:385]: Vertical Swing Status = 0x0
[22:45:55][D][haier.climate:387]: Set Point Status = 0x2
[22:45:57][D][climate:010]: 'Slaapkamer Airco' - Setting
[22:45:57][D][climate:039]:   Target Temperature: 17.00
[22:45:57][D][Control:223]: Control call
[22:45:57][I][haier.climate:126]: Control packet sent
[22:45:57][D][haier.protocol:019]: Sending frame: type 01, data: 4D 5F 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 24 00 00 00 01
[22:45:57][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 20 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 24 00 00 00 01
[22:45:57][D][climate:385]: 'Slaapkamer Airco' - Sending state:
[22:45:57][D][climate:388]:   Mode: OFF
[22:45:57][D][climate:393]:   Fan Mode: HIGH
[22:45:57][D][climate:405]:   Swing Mode: OFF
[22:45:57][D][climate:408]:   Current Temperature: 13.00°C
[22:45:57][D][climate:414]:   Target Temperature: 17.00°C
[22:45:57][I][haier.climate:377]: HVAC values changed
[22:45:57][I][haier.climate:379]: HVAC Mode = 0x2
[22:45:57][I][haier.climate:381]: Fan speed Status = 0x0
[22:45:57][I][haier.climate:383]: Horizontal Swing Status = 0x0
[22:45:57][I][haier.climate:385]: Vertical Swing Status = 0x0
[22:45:57][I][haier.climate:387]: Set Point Status = 0x1
[22:45:59][D][haier.protocol:019]: Sending frame: type 01, data: 4D 01
[22:46:00][D][haier.protocol:019]: Frame found: type 02, data: 6D 01 00 0D 00 21 00 7F 00 00 00 00 00 02 00 00 00 00 00 10 00 24 00 00 00 01
[22:46:00][D][haier.climate:379]: HVAC Mode = 0x2
[22:46:00][D][haier.climate:381]: Fan speed Status = 0x0
[22:46:00][D][haier.climate:383]: Horizontal Swing Status = 0x0
[22:46:00][D][haier.climate:385]: Vertical Swing Status = 0x0
[22:46:00][D][haier.climate:387]: Set Point Status = 0x1
[22:46:04][D][haier.protocol:019]: Sending frame: type 01, data: 4D 01

Yes sorry, it looks like it is not beeper off but some kind of night mode.
But it looks like your AC is reporting something interesting that I haven’t seen before:

4D 5F 00 0D 00 20

4D 5F - subcommand
0D - room temperature
and 20 is something that I have never seen before, usually, there is 0. My version is that this is humidity 0x20 = 32% Is your AC have dehumidification functionality? Is there a way to set target humidity from IR remote?

Yes there is an option “DRY” on the remote, see picture on page 4 of manual for this model (AS25S2SF2FA-1):

I have the dry mode too, but there is no way to set the target humidity with the IR remote. Not sure why this is being reported.

When you do the ESP restart there should be some e++ protocol version in the log shown, that might be a clue about yet different implementation.

But maybe that Is just for hOn, i do not remember anymore :frowning:

Nope, it is just for hOn, smartair gives an invalid answer for this command.

@evlo
BTW the last changes on dev branch probably should fix your problems with the Bluetooth proxy. I improved a little bit performance. Also, I really recommend using haier component without web_server. It causes a lot of performance issues.

2 Likes

even with webserver and bt proxy and logger

  logs:
    bluetooth_proxy: DEBUG
    esp32_ble: DEBUG
    json: DEBUG
    sensor: DEBUG
    haier.protocol: DEBUG

does not get hot, so I think not much load on CPU

image

1 Like

I’m on smartair2_test branch with bluetooth proxy on and works fine (with esp-idf framework).

1 Like

@evlo
Nice :slight_smile: ALways wanted a thermal camera, Cool stuff
I was using M5stamp pico: M5Stamp Pico (5pcs) | m5stack-store for some time and they were very unstable because of the heat.

@pvh0 thanks for letting me know. I am asking because I am not using a BT proxy so not really sure what to expect from this setup.

@All,
One of our colleagues donated me the KZW-W002 module from smartair2 AC (huge thanks for your support) and today I received it. Also, I wrote some kind of simulator smartAir2 AC (as well as a hOn simulator). I was able to make them work together so now I have a safe playground to try my crazy ideas :nerd_face: First thing I noticed is that the module reports WiFi signal level in a similar way as hOn modules. Are there smartair2 ACs that show signal level? Do you want me to support this feature the same way as for hOn ACs? It should be quite easy.

1 Like

Oh, I did not know just module would be helpful to you, i do have spare one for smartAir2, i can send it to the paczkomat if you could use more examples :slight_smile:

I will see how stampS3 likes the temperatures, as I run it in original enclosure like this


:slight_smile:

It wasn’t but I recently implemented a simulator for testing if my code working with smartAir2 AC. And then I got the idea that the same simulator can help me to check how the original module works.

I don’t need another one, I am not going to do any hardware modifications just software tricks. If you want you can also use your spare module with the simulator. It is available in my HaierProtocol repo GitHub - paveldn/HaierProtocol: Haier communication protocol library (test folder). You will need cmake and Visual Studio community edition. If you will need help - let me know.

I hope M5stamp will be better than M5stamp pico. And cool idea using original enclosure.

I have tested it on the table for only about 15 minutes it kept at under 50C, after putting into enclosure into AC it does indeed restart (every about 15 minutes, obviously :slight_smile: ) and https://github.com/esphome/esphome/pull/4330 reports 80C.

So I tried compile again without BT proxy

Compiling /data/eh-ac-obyvak/.pioenvs/eh-ac-obyvak/src/esphome/components/haier/hon_climate.o
Compiling /data/eh-ac-obyvak/.pioenvs/eh-ac-obyvak/src/esphome/components/haier/logger_handler.o
Compiling /data/eh-ac-obyvak/.pioenvs/eh-ac-obyvak/src/esphome/components/haier/smartair2_climate.o
In file included from src/esphome/components/climate/climate.h:7,
                 from src/esphome/components/haier/haier_base.cpp:3:
src/esphome/components/haier/haier_base.cpp: In member function 'void esphome::haier::HaierClimateBase::set_phase_(esphome::haier::HaierClimateBase::ProtocolPhases)':
src/esphome/components/haier/haier_base.cpp:83:19: error: format '%d' expects argument of type 'int', but argument 5 has type 'esphome::haier::HaierClimateBase::ProtocolPhases' [-Werror=format=]
     ESP_LOGV(TAG, "Phase transition: %d => %d", this->protocol_phase_, phase);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:69:36: note: in definition of macro 'ESPHOME_LOG_FORMAT'
 #define ESPHOME_LOG_FORMAT(format) format
                                    ^~~~~~
src/esphome/core/log.h:156:28: note: in expansion of macro 'esph_log_v'
 #define ESP_LOGV(tag, ...) esph_log_v(tag, __VA_ARGS__)
                            ^~~~~~~~~~
src/esphome/components/haier/haier_base.cpp:83:5: note: in expansion of macro 'ESP_LOGV'
     ESP_LOGV(TAG, "Phase transition: %d => %d", this->protocol_phase_, phase);
     ^~~~~~~~
src/esphome/components/haier/haier_base.cpp:83:19: error: format '%d' expects argument of type 'int', but argument 6 has type 'esphome::haier::HaierClimateBase::ProtocolPhases' [-Werror=format=]
     ESP_LOGV(TAG, "Phase transition: %d => %d", this->protocol_phase_, phase);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:69:36: note: in definition of macro 'ESPHOME_LOG_FORMAT'
 #define ESPHOME_LOG_FORMAT(format) format
                                    ^~~~~~
src/esphome/core/log.h:156:28: note: in expansion of macro 'esph_log_v'
 #define ESP_LOGV(tag, ...) esph_log_v(tag, __VA_ARGS__)
                            ^~~~~~~~~~
src/esphome/components/haier/haier_base.cpp:83:5: note: in expansion of macro 'ESP_LOGV'
     ESP_LOGV(TAG, "Phase transition: %d => %d", this->protocol_phase_, phase);
     ^~~~~~~~
src/esphome/components/haier/haier_base.cpp: In member function 'haier_protocol::HandlerError esphome::haier::HaierClimateBase::timeout_default_handler_(uint8_t)':
src/esphome/components/haier/haier_base.cpp:156:17: error: format '%d' expects argument of type 'int', but argument 6 has type 'esphome::haier::HaierClimateBase::ProtocolPhases' [-Werror=format=]
   ESP_LOGW(TAG, "Answer timeout for command %02X, phase %d", request_type, this->protocol_phase_);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:69:36: note: in definition of macro 'ESPHOME_LOG_FORMAT'
 #define ESPHOME_LOG_FORMAT(format) format
                                    ^~~~~~
src/esphome/core/log.h:148:28: note: in expansion of macro 'esph_log_w'
 #define ESP_LOGW(tag, ...) esph_log_w(tag, __VA_ARGS__)
                            ^~~~~~~~~~
src/esphome/components/haier/haier_base.cpp:156:3: note: in expansion of macro 'ESP_LOGW'
   ESP_LOGW(TAG, "Answer timeout for command %02X, phase %d", request_type, this->protocol_phase_);
   ^~~~~~~~
cc1plus: some warnings being treated as errors
*** [/data/eh-ac-obyvak/.pioenvs/eh-ac-obyvak/src/esphome/components/haier/haier_base.o] Error 1

this is both using

- source: github://pr#4521 
- source: github://paveldn/ESP32-S0WD-Haier@dev

it is logger related,
with

logger:
  level: VERBOSE
  logs:
    bluetooth_proxy: DEBUG
    esp32_ble: DEBUG
    json: DEBUG
    sensor: DEBUG
    haier.protocol: WARN
    haier.climate: WARN
    climate: WARN
    web_server_idf: WARN
    mdns: DEBUG
  hardware_uart: USB_SERIAL_JTAG

I do get that error, with

logger:
  level: DEBUG
  baud_rate: 0

I can compile.

Also possibly my original logger configuration does not make sense and that is why I do get the error :slight_smile:

Oh, sorry my fault. Damn conversion. Will fix in couple of minutes

Strange that I couldn’t reproduce the issue. But anyway It should be fixed, please pull the latest changes. Let me know if it helped.

Now it works even with very limited logger - screenshot bellow is with BT proxy active


I hope the temperature will get more reasonable, but at least it is now possible to monitor it and experiment.
But I found out it does not reset, but just resets the wifi connection.

After removing the bt proxy and keeping the web server (as I sometime use it) temperature does go lower.

I think the metal cover on the esp modules is actually used as heat spreader? Definitely the packed installation does not help.

Update: Now, without bt proxy, it runs at about 65C and does not disconnect from wifi. 65C internal seems very reasonable.

Update2: Interestingly with 2023.3.0 release I do get about 37C internal CPU temperature.

Hi @paveldn, just wanted to let you know I’ve just checked back in on this thread. I’ve tested your updated code per the pull request to placed into ESPHome. Your code base from PR4521 respects the light configuration when updated from the remote.

Thanks a lot for fixing this.

1 Like

Wow, maybe I will need to give a try to pico once again :slight_smile: Thanks for letting me know!

Thanks for testing!

Mine does not show signal level on the AC or remote, but would be a nice option indeed!

1 Like

Hi everybody,

On top of the dev branch, you can find some new features implemented. One of the things is self-cleaning support for hOn ACs.
Also recently I received my raspberry pi pico w board, tested it and it is working. So now it is official you can use raspberry pi pico w with haier ACs it works with both SmartAir2 and hOn.

2 Likes