$ show echavet/MitsubishiCN105ESPHome
This repository provides an ESPHome external component and a Home Assistant custom component for controlling Mitsubishi heat pumps via the CN105 serial interface. The core component implements a full climate controller with dual setpoint support, multiple operating modes (heat, cool, heat_cool, dry, fan_only), fan speeds, swing modes, remote temperature integration, and a wide array of sensors (compressor frequency, power, kWh, outside temperature, error codes, etc.). It communicates with the heat pump over UART at 2400 baud using a reverse-engineered protocol with checksum validation and cyclic request scheduling. The Home Assistant proxy component dynamically adjusts the UI to show single or dual setpoint sliders based on the active mode, fixes Auto mode behavior, and supports advanced features like coordinator single-target mode for multi-zone systems. The codebase is well-structured with standalone reusable modules for frame parsing, protocol encoding/decoding, request scheduling, and temperature conversion, supported by a comprehensive unit test suite and CI pipeline. The repository includes example configurations for various microcontrollers (ESP32, Xiao, M5Stack) and deployment scenarios, making it a mature and practical solution for integrating Mitsubishi heat pumps into smart home systems.
The LLM identified 5 files worth highlighting for reuse:
Standalone UART frame parser with overflow protection and checksum validation. It assembles bytes into complete frames and validates integrity. Can be reused in any serial project requiring framed messages with checksum.
Collection of pure functions for Mitsubishi CN105 protocol: checksum calculation, temperature encoding/decoding (including Fahrenheit support), byte-map lookups with fallback, and grace window predicates. Independent of the ESPHome framework and easily portable to other environments.
Generic cyclical request scheduler that manages timed info requests with configurable intervals, soft timeouts, failure counting, and send/response callbacks. Ensures orderly UART communication and can be adapted to any polling-based protocol.
Simple cycle timer and timeout logic for periodic operations. Provides callback-based timing with configurable intervals and reset functionality. Lightweight and reusable in embedded systems.
Table-driven Fahrenheit to Celsius conversion with three lookup tables for stable round-trip accuracy across different heat pump models. Ensures precise temperature unit conversion and can be reused in any application requiring consistent Fahrenheit support.