wordclock_esp8266
Software for a Wordclock based on ESP8266 and Neopixel LEDs with PONG, TETRIS, SNAKE game modes
Haier ac integration for ESPHome
git clone https://github.com/paveldn/haier-esphome.gitpaveldn/haier-esphomeThis is an implementation of the ESPHome component to control HVAC on the base of the SmartAir2 and hOn Haier protocols (AC that is controlled by the hOn or SmartAir2 application).
There are two versions of the Haier protocol: the older version uses an application called SmartAir2 while the newer version uses an application called hOn. Both protocols are compatible on the transport level but utilize different commands to control appliances.
Older Haier models controlled by the SmartAir2 application are using the KZW-W002 module. This module can't be reused, and you need to replace it with an ESP or RPI Pico W module. The USB connector on the board doesn't support the USB protocol. It is a UART port that just uses a USB connector. To connect the ESP board to your AC you can cut a USB type A cable and connect wires to the climate connector.
Haier UART pinout| Board | USB | Wire color | ESP8266 |
|---|---|---|---|
| 5V | VCC | red | 5V |
| GND | GND | black | GND |
| TX | DATA+ | green | RX |
| RX | DATA- | white | TX |
Newer Haier models using a module called ESP32-for-Haier. It is an ESP32 single-core board with an ESP32-S0WD chip. In some cases, you can reuse this module and flash it with ESPHome, but some new modules don't support this. They look the same but have encryption enabled.
Warning! The new generation of ESP32-Haier devices has encryption enabled, so they can only be flashed with firmware that is signed with a private key. There is no way to make them work with ESPHome, so if you try to do it, the board will get into a boot loop with the error rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) The only way to recover this board is to flash it with the original image. So before starting your experiments make a backup image.
Also, you can use any other ESP32, ESP8266, or an RPI pico W board. In this case, you will need to cut the original wire or make a connector yourself (the board has a JST SM04B-GHS-TB connector)
This component requires a UART Bus to be setup.
# Example configuration entry
climate:
- platform: haier
id: haier_ac
protocol: hon
name: Haier AC
uart_id: ac_port
wifi_signal: true
display: true
visual:
min_temperature: 16 °C
max_temperature: 30 °C
temperature_step: 1 °C
supported_modes:
- 'OFF'
- HEAT_COOL
- COOL
- HEAT
- DRY
- FAN_ONLY
supported_swing_modes:
- 'OFF'
- VERTICAL
- HORIZONTAL
- BOTH
supported_presets:
- AWAY
- BOOST
- SLEEP
on_alarm_start:
then:
- logger.log:
level: WARN
format: "Alarm activated. Code: %d. Message: \"%s\""
args: [ code, message]
on_alarm_end:
then:
- logger.log:
level: INFO
format: "Alarm deactivated. Code: %d. Message: \"%s\""
args: [ code, message]
on_status_message:
then:
- logger.log:
level: INFO
format: "New status message received, size=%d, subcmd=%02X%02X"
args: [ 'data_size', 'data[0]', 'data[1]' ]
hon or smartair2. The default value is smartair2.true - send wifi signal level to AC.200ms.true - use alternative values to control swing mode. Use only if the original control method is not working for your AC.0.10.22, minimum value: 18.MONITOR_ONLY - no control, just monitor status, SET_GROUP_PARAMETERS - set all AC parameters with one command (default method), SET_SINGLE_PARAMETER - set each parameter individually (this method is supported by some new ceiling ACs like AD71S2SM3FA)'OFF', HEAT_COOL, COOL, HEAT, DRY, FAN_ONLY.'OFF', VERTICAL, HORIZONTAL, BOTH.AWAY, BOOST, COMFORT. Possible values for hOn are: AWAY, BOOST, SLEEP. AWAY preset can be enabled only in HEAT mode, it is disabled by default.on_alarm_start TriggerThis automation will be triggered when a new alarm is activated by AC. The error code of the alarm will be given in the variable code (uint8_t), error message in the variable message (const char *). Those variables can be used in lambdas.
climate:
- protocol: hon
on_alarm_start:
then:
- logger.log:
level: WARN
format: "Alarm activated. Code: %d. Message: \"%s\""
args: [ 'code', 'message' ]
on_alarm_end TriggerThis automation will be triggered when a previously activated alarm is deactivated by AC. The error code of the alarm will be given in the variable code (uint8_t), error message in the variable message (const char *). Those variables can be used in lambdas.
climate:
- protocol: hon
on_alarm_end:
then:
- logger.log:
level: INFO
format: "Alarm deactivated. Code: %d. Message: \"%s\""
args: [ 'code', 'message' ]
on_status_message TriggerThis automation will be triggered when component receives new status packet from AC. Raw message binary (without header and checksum) will be provided in the variable data (const char *), message length in the variable data_size (uint8_t). Those variables can be used in lambdas.
This trigger can be used to support some features that unique for the model and not supported by others.
climate:
- protocol: hon
on_status_message:
then:
- logger.log:
level: INFO
format: "New status message received, size=%d, subcmd=%02X%02X"
args: [ 'data_size', 'data[0]', 'data[1]' ]
climate.haier.power_on ActionThis action turns AC power on.
on_...:
then:
climate.haier.power_on: device_id
climate.haier.power_off ActionThis action turns AC power off
on_...:
then:
climate.haier.power_off: device_id
climate.haier.power_toggle ActionThis action toggles AC power
on_...:
then:
climate.haier.power_toggle: device_id
climate.haier.display_on ActionThis action turns the AC display on.
on_...:
then:
climate.haier.display_on: device_id
climate.haier.display_off ActionThis action turns the AC display off.
on_...:
then:
climate.haier.display_off: device_id
climate.haier.health_on ActionTurn on health mode (UV light sterilization).
on_...:
then:
climate.haier.health_on: device_id
climate.haier.health_off ActionTurn off health mode.
on_...:
then:
climate.haier.health_off: device_id
climate.haier.beeper_on Action(supported only by hOn) This action enables beep feedback on every command sent to AC.
on_...:
then:
climate.haier.beeper_on: device_id
climate.haier.beeper_off Action(supported only by hOn) This action disables beep feedback on every command sent to AC (keep in mind that this will not work for IR remote commands).
on_...:
then:
climate.haier.beeper_off: device_id
climate.haier.set_vertical_airflow Action(supported only by hOn) Set direction for vertical airflow if the vertical swing is disabled. Possible values: Health_Up, Max_Up, Up, Center, Down, Health_Down.
on_...:
then:
- climate.haier.set_vertical_airflow:
id: device_id
vertical_airflow: Up
climate.haier.set_horizontal_airflow Action(supported only by hOn) Set direction for horizontal airflow if the horizontal swing is disabled. Possible values: Max_Left, Left, Center, Right, Max_Right.
on_...:
then:
- climate.haier.set_horizontal_airflow:
id: device_id
vertical_airflow: Right
climate.haier.start_self_cleaning Action(supported only by hOn) Start self-cleaning.
on_...:
then:
- climate.haier.start_self_cleaning: device_id
climate.haier.start_steri_cleaning Action(supported only by hOn) Start 56°C steri-cleaning.
Additional sensors for Haier Climate device. These sensors are supported only by the hOn protocol.
# Example configuration entry
sensor:
- platform: haier
haier_id: haier_ac
outdoor_temperature:
name: Haier outdoor temperature
humidity:
name: Haier Indoor Humidity
compressor_current:
name: Haier Compressor Current
compressor_frequency:
name: Haier Compressor Frequency
expansion_valve_open_degree:
name: Haier Expansion Valve Open Degree
indoor_coil_temperature:
name: Haier Indoor Coil Temperature
outdoor_coil_temperature:
name: Haier Outdoor Coil Temperature
outdoor_defrost_temperature:
name: Haier Outdoor Defrost Temperature
outdoor_in_air_temperature:
name: Haier Outdoor In Air Temperature
outdoor_out_air_temperature:
name: Haier Outdoor Out Air Temperature
power:
name: Haier Power
Additional sensors for Haier Climate device. These sensors are supported only by the hOn protocol.
# Example configuration entry
binary_sensor:
- platform: haier
haier_id: haier_ac
compressor_status:
name: Haier Outdoor Compressor Status
defrost_status:
name: Haier Defrost Status
four_way_valve_status:
name: Haier Four Way Valve Status
indoor_electric_heating_status:
name: Haier Indoor Electric Heating Status
indoor_fan_status:
name: Haier Indoor Fan Status
outdoor_fan_status:
name: Haier Outdoor Fan Status
Additional sensors for Haier Climate device. These sensors are supported only by the hOn protocol.
# Example configuration entry
text_sensor:
- platform: haier
haier_id: haier_ac
appliance_name:
name: Haier appliance name
cleaning_status:
name: Haier cleaning status
protocol_version:
name: Haier protocol version
Additional buttons for Haier AC cleaning. These buttons are supported only by the hOn protocol.
# Example configuration entry
button:
- platform: haier
haier_id: haier_ac
self_cleaning:
name: Haier start self cleaning
steri_cleaning:
name: Haier start 56°C steri-cleaning
Additional switches to support additional features for Haier AC.
# Example configuration entry
switch:
- platform: haier
beeper:
name: Haier beeper
health_mode:
name: Haier health mode
display:
name: Haier display
quiet_mode:
name: Haier quiet mode
It is strongly recommended to make a backup of the original flash content before flashing ESPHome!
To make a backup and to flash the new firmware you will need to use a USB to TTL converter and solder wires to access UART0 on board (or use something like this: Pogo Pin Probe Clip 2x5p 2.54 mm)
UART0 pinout:
To put the device in the flash mode you will need to shortcut GPIO0 to the ground before powering the device.
Once the device is in flash mode you can make a full backup of the original firmware in case you would like to return the module to its factory state. To make a backup you can use esptool. Command to make a full flash backup:
python esptool.py -b 115200 –port read_flash 0x00000 0x400000 flash_4M.bin
After this, you can flash firmware using ESPHome tools (dashboard, website, esphome command, etc) .. Generated from additional_information.rst
more like this
Software for a Wordclock based on ESP8266 and Neopixel LEDs with PONG, TETRIS, SNAKE game modes
A small display for ESPHome and Home Assistant to retrieve the current house consumption and energy price via a sensor…
search projects, people, and tags