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

Yes, I know it. I am waiting for ESPHome support for Fan Speed

1 Like

hi, i have problem compiling the code.
i get this

C:\esphaier-master>esphome esphaier.yaml run
e[32mINFO Reading configuration esphaier.yaml...e[0m
e[32mINFO Generating C++ source...e[0m
e[32mINFO Compiling app...e[0m
e[32mINFO Running:  platformio run -d haiere[0m
Processing haier (board: d1_mini; framework: arduino; platform: [email protected])
------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 2.2.3 > WeMos D1 R2 and mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: toolchain-xtensa 1.40802.0 (4.8.2), framework-arduinoespressif8266 2.20502.0 (2.5.2), tool-esptool 1.409.0 (4.9), tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Looking for Update library in registry
Warning! Library `{'name': 'Update', 'requirements': None}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'name': 'Update', 'requirements': None}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
Compiling .pioenvs\haier\src\main.cpp.o
In file included from src\main.cpp:12:0:
src\Haier.h: In member function 'void Haier::readData()':
src\Haier.h:147:20: error: reference to 'CLIMATE_MODE_OFF' is ambiguous
             mode = CLIMATE_MODE_OFF;
                    ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:47:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_OFF
   CLIMATE_MODE_OFF = 0,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:11:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_OFF
   CLIMATE_MODE_OFF = 0,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h:153:28: error: reference to 'CLIMATE_MODE_COOL' is ambiguous
                     mode = CLIMATE_MODE_COOL;
                            ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:49:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_COOL
   CLIMATE_MODE_COOL = 2,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:15:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_COOL
   CLIMATE_MODE_COOL = 2,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h:156:28: error: reference to 'CLIMATE_MODE_HEAT' is ambiguous
                     mode = CLIMATE_MODE_HEAT;
                            ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:50:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_HEAT
   CLIMATE_MODE_HEAT = 3,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:17:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_HEAT
   CLIMATE_MODE_HEAT = 3,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h:159:28: error: reference to 'CLIMATE_MODE_AUTO' is ambiguous
                     mode = CLIMATE_MODE_AUTO;
                            ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:48:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_AUTO
   CLIMATE_MODE_AUTO = 1,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:13:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_AUTO
   CLIMATE_MODE_AUTO = 1,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h: In member function 'virtual void Haier::control(const esphome::climate::ClimateCall&)':
src\Haier.h:177:22: error: reference to 'CLIMATE_MODE_AUTO' is ambiguous
                 case CLIMATE_MODE_AUTO:
                      ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:48:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_AUTO
   CLIMATE_MODE_AUTO = 1,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:13:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_AUTO
   CLIMATE_MODE_AUTO = 1,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h:181:22: error: reference to 'CLIMATE_MODE_HEAT' is ambiguous
                 case CLIMATE_MODE_HEAT:
                      ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:50:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_HEAT
   CLIMATE_MODE_HEAT = 3,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:17:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_HEAT
   CLIMATE_MODE_HEAT = 3,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h:185:22: error: reference to 'CLIMATE_MODE_COOL' is ambiguous
                 case CLIMATE_MODE_COOL:
                      ^
In file included from src\esphome/components/api/api_connection.h:5:0,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src\esphome/components/api/api_pb2.h:49:3: note: candidates are: esphome::api::EnumClimateMode CLIMATE_MODE_COOL
   CLIMATE_MODE_COOL = 2,
   ^
In file included from src/esphome/components/climate/climate.h:6:0,
                 from src/esphome/core/application.h:27,
                 from src\esphome/components/api/api_connection.h:4,
                 from src\esphome.h:2,
                 from src\main.cpp:3:
src/esphome/components/climate/climate_mode.h:15:3: note:                 esphome::climate::ClimateMode CLIMATE_MODE_COOL
   CLIMATE_MODE_COOL = 2,
   ^
In file included from src\main.cpp:12:0:
src\Haier.h:173:20: warning: enumeration value 'CLIMATE_MODE_OFF' not handled in switch [-Wswitch]
             switch (call.get_mode().value()) {
                    ^
src\Haier.h:173:20: warning: enumeration value 'CLIMATE_MODE_AUTO' not handled in switch [-Wswitch]
src\Haier.h:173:20: warning: enumeration value 'CLIMATE_MODE_COOL' not handled in switch [-Wswitch]
src\Haier.h:173:20: warning: enumeration value 'CLIMATE_MODE_HEAT' not handled in switch [-Wswitch]
Compiling .pioenvs\haier\FrameworkArduino\time.cpp.o
Compiling .pioenvs\haier\FrameworkArduino\uart.cpp.o
Compiling .pioenvs\haier\FrameworkArduino\umm_malloc\umm_malloc.cpp.o
*** [.pioenvs\haier\src\main.cpp.o] Error 1
============================================== [FAILED] Took 2.12 seconds ==============================================

C:\esphaier-master>

Could you tell me why?

Thank you

Paolo

Jums… It look like that you include two times the file.

Can you paste the yalm file?

esphome:
  name: haier
  platform: ESP8266
  board: d1_mini
  includes:
    - Haier.h


logger:
  level: DEBUG
  baud_rate: 0 #Important. You can't use serial port
  
  
wifi:
  ssid: "PAOLO_AZZU_CASA"
  password: "abcdefghi"


# Enable Home Assistant API
api:
  password: "abcdefghi"

ota:
  password: "abcdefghi"



  
  
climate:
  - platform: custom
    lambda: |-
      auto haier = new Haier();
      App.register_component(haier);
      return {haier};
    climates:
      - name: "Haier"

i run the command
esphome esphaier.yaml run
from the directory
C:\esphaier-master\

Good news! I’ve re-installed esphome, now it works fine!
Thank you

1 Like

Hello guys I did correctly connected my AC with Hassio and all are working excellent except that I can never know when my AC is ON or OFF. Its always shows the mode of the AC before becomes off. It shows that is OFF rarely and randomly. Please is very important for me to know when is ON or OFF when I am away.
I have attached some screenshots that may help.

I don’t understand.

Do you can show the status in Home Assistant?

In your screenshot show “mode: HEAT”, so, it is on. If the current is 19 and the tarjet is 30 and the mode is heat, the AC must heat the room…

No the AC actually is OFF but the mode in logs of ESPHOME shows that is ON and HEAT.
Due to this I can never be sure when the AC is ON or OFF.

For example as we speak now became Off randomly :confused:

1 Like

UPDATE: I want to thank [Miguel Ángel] so much. He helped me to solve my issue and now it is working perfectly.
(I added also another condition in POWER_OFF state)

Hi thanks for sharing. Do you mind telling us which model of the Air Conditioner you bought? I coudn’t find one that comes with USB cable/module.

This: https://www.leroymerlin.es/fp/81988152/-aire-acondicionado-1-x-1-tundra-2200-fr-2388-cal?pathFamilaFicha=x01374

Hi everybody. Thanks for this project!

Maybe I can count on your support. I went through all instructions. connect NodeMCU with usb cable as stated. Successfully flashed ESP with esphome.

HA found new climate device but there is no possibility to control. It does not get any messages (temperature) or send any information. In HA it is always as off.

When I try to change something in logs I get only:

Do you have any clue why it is s?

Maybe you Haier use other protocols or the connection is not correct.

Could you up a photo of you esp connection?

They wanted to sell me wifi module KZW-W002. Please find below photos.

I thought that there is an iisue with cable so I took USB-UART module with 5V connected to NodeMCU. Same situation.

Um… KZW-W002 is the same that use my AC and the connections look good…

The zeros in the logs mean that it is not reading data… Maybe you AC need active the USB devices…

But what do you mean active? Is there any procedure? I have bought without WiFi dongle.

No idea, maybe you must set a option in remote?

Other posibility, the colours of you USB are worng. Test to change green and white wires.

Hi,

We have a Haier comming in and i wonder if it’s possible to use a “usb-splitter”, so we can use both the Wifi dongle (for the misses :wink: ) and the ESP-Haier for home-assistant

I don’t know, but… I think that is not possible. They don’t use a “usb protocol”, only a usb connector, but the protocol is a standar serial.

1 Like