Many AC units ship with IR-only remotes and no smart control interface, making home automation integration difficult. This custom ESPHome component, modernized from @iverasp’s original work, implements the YK-H/531E IR protocol so an ESP32 or ESP8266 can control compatible air conditioners over infrared.

Features

In addition to what was already working I added a few features to my custom YKH531E component it includes the following capabilities:

  • Temperature Range: 16-32°C (60-90°F)
  • Operating Modes: Auto, Cool, Dry, Fan, Heat (heat is untested)
  • Fan Speeds: Low, Medium, High, Auto
  • Swing Control: Vertical swing support (Corrected)
  • Temperature Units: Support for both Celsius and Fahrenheit (Fahrenheit added!)

Installation

Adding the component to your ESPHome configuration is straightforward:

1
2
3
external_components:
  - source: github://smazurov/esphome-ykh531e
    components: [ykh531e]

Configuration

Here’s a basic configuration example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
remote_transmitter:
  pin: GPIO14
  carrier_duty_percent: 50%

climate:
  - platform: ykh531e
    name: "AC Unit"
    supports_heat: false
    supports_cool: true
    use_fahrenheit: true
  • IR Transmitter: Connect to any GPIO pin (GPIO14 in the example)
  • IR Receiver (optional).

Note: You need enough RMT capacity on your esp32 or channels if using arduino framework.

ESP32 hardware setup with IR transmitter on breadboard

The IR transmitter allows the ESP device to send commands to the AC unit, while the optional receiver can capture commands from the original remote to keep the ESPHome state synchronized.

Optional automatic thermostat

If you want your esphome to control when the unit turns on and off, modify the above config:

 1
 2
 3
 4
 5
 6
 7
 8
 9
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
37
38
39
40
41
- platform: ykh531e
  name: "ir remote"
  supports_cool: true
  supports_heat: false
  receiver_id: r
  use_fahrenheit: true
  id: ir_ac
  internal: true # Hide from HA
# Create a thermostat that controls the IR unit
- platform: thermostat
  name: "Frigidaire AC"
  id: smart_thermostat
  sensor: ha_office_temperature_sensor

  min_cooling_off_time: 180s
  min_cooling_run_time: 180s
  min_idle_time: 60s

  cool_action:
    - climate.control:
        id: ir_ac
        mode: COOL
        target_temperature: 24°C
        swing_mode: VERTICAL

  idle_action:
    - climate.control:
        id: ir_ac
        mode: "OFF"

  default_preset: Home
  preset:
    - name: Home
      default_target_temperature_high: 24
      mode: "COOL"
    - name: Sleep
      default_target_temperature_high: 30
      mode: "OFF"
    - name: Away_Cool
      default_target_temperature_high: 22
      mode: "COOL"

Note if use_fahrenheit: true and ha_office_temperature_sensor is reporting in fahrenheit, remember to convert the sensor value to celsius

Compatibility

Currently tested with the Frigidaire FHPC102AC1, but should work with other AC units using the YK-H/531E remote. Untested list includes:

FHPC082AB1, FHPC102AB1, FHPC132AB1, FHPH132AB1, FHPC082AB10, FHPC102AB10, FHPC132AB10, FHPH132AB10, FFPA0822U1, FFPA0822U10, FFPA0822U100, FFPA1022U1, FFPA1022U10, FFPA1022U100, FFPA1222U1, FFPA1222U10, FFPA1222U100, FFPA1422U1, FFPA1422U10, FFPA1422U100, FHPC082AC1

The source code is available on GitHub for those interested in contributing or adapting it for similar protocols. If you have any issues or have further enhancements, feel free to contribute or open an issue.

Prior Art