I was looking to build an ESPHome sensor that can sit beside my Air Conditioner unit and allow me to remotely control my AC. I also wanted the state of the AC on my Home Assistant instance to be in sync with the AC if someone used the remote control.
It could be me, but I did not find a comprehensive enough guide and it took me a full day to cobble things up. Hence posting my work here for others. Hope it is useful.
Sensors used
- DHT-22 for temperature and humidity
- KY-022 Infrared Sensor Receiver Module
- KY-005 38KHz Infrared Transmitter module
Board used: ESP32
For wiring, refer to the pin_*
variables in the substitutions below.
To make this work with your variant of AC, refer to the link near the climate:
section.
substitutions:
name: climate-control-esph-1337
friendly_name: Climate Control ESPH-1337
pin_status_led: GPIO2
pin_transmitter: GPIO4
pin_receiver: GPIO12
pin_dht: GPIO14
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp32:
board: esp32dev
framework:
type: arduino
logger: # Enable logging
api: # Enable Home Assistant API
ota: # Allow Over-The-Air updates
improv_serial: # Allow provisioning Wi-Fi via serial
wifi: # Enable WiFi
# -----------------------------------------------------------------
light:
- platform: status_led
id: builtin_led
# name: "Status Light"
pin: ${pin_status_led}
remote_transmitter:
id: heatpump_remote_transmitter
# name: "IR Transmitter"
pin: ${pin_transmitter}
carrier_duty_percent: 50%
remote_receiver:
id: heatpump_remote_receiver
# name: "IR Receiver"
pin:
number: ${pin_receiver}
inverted: true
mode:
input: true
pullup: true
# high 55% tolerance is recommended for some remote control units
tolerance: 55%
filter: 10us
idle: 25ms
sensor:
- platform: dht
pin: ${pin_dht}
model: DHT22
temperature:
# name: "Temperature"
id: heatpump_room_temperature
humidity:
# name: "Humidity"
id: heatpump_room_humidity
# Refer the following for other platforms of ACs
# https://esphome.io/components/climate/climate_ir.html
climate:
- platform: daikin
name: "Daikin AC"
id: my_daikin_ac
transmitter_id: heatpump_remote_transmitter
receiver_id: heatpump_remote_receiver
sensor: heatpump_room_temperature
visual:
min_temperature: 18
max_temperature: 32
temperature_step:
target_temperature: 1
current_temperature: 0.1