This is an old revision of the document!
This project extends an existing Home Assistant setup (on Raspberry Pi 3) to control IR-only devices via an ESP32 acting as an IR transceiver. We use the YS-IRTM module to sniff and replay NEC-protocol commands, exposing each learned code as a Home Assistant entity. With this hub in place, you can automate your stereo system and air conditioner directly from Home Assistant or a mobile app.
Total cost: 79 RON
1. YS-IRTM decodes NEC IR and emits 3 bytes over UART. 2. ESPHome buffers up to 3 bytes, then publishes an MQTT/state update (`ir_hub/last_command`). 3. Home Assistant sensor template splits bytes into user-code and command.
1. Home Assistant invokes `switch.ir_send_<device>_<cmd>`. 2. ESPHome writes the 5-byte payload (Addr: 0xA1, F1: 0xF1, UC High, UC Low, Cmd) to UART. 3. YS-IRTM sends the NEC frame on IR LED (9 ms mark, 4.5 ms space, data bits @ 562 µs ×38 kHz). 4. Module replies with 0xF1 on success; ESPHome retries once after 1 s if no ack.
All NEC remotes in the stereo system are successfully learned and replayed via Home Assistant, enabling automated scenes and mobile control. OTA updates allow incremental feature additions without physical access.
This ESP32 + YS-IRTM hub provides a low-cost, NEC-only IR bridge that integrates seamlessly with Home Assistant. With minor hardware changes, it can be extended to support arbitrary IR protocols.