$ account RobHofmann
This is a Home Assistant custom component (integration) for controlling Gree-compatible air conditioners over the local network via UDP. It implements the Gree reverse-engineered protocol, supporting two encryption versions (AES-128 ECB and AES-128 GCM), device discovery, key negotiation, and full HVAC control (temperature, fan, swing, modes). The architecture follows Home Assistant's platform pattern: a climate entity as the core, with additional switch, sensor, number, and select entities for auxiliary features like X-Fan, lights, health mode, temperature step, and external temperature sensor selection. The integration communicates directly with the AC unit on UDP port 7000, encrypting commands with device-specific keys obtained during setup. It supports both UI config flow (with auto-discovery and cross-VLAN unicast scanning) and YAML configuration. The codebase is well-structured for a custom component, with clear separation of protocol logic (gree_protocol.py), temperature math (helpers.py), and entity definitions. Notable craftsmanship includes the TempOffsetResolver class for auto-detecting sensor offsets, the retry logic with progressive backoff and diagnostic failure classification, and the use of dataclass-based entity descriptions for switches and sensors. However, the main climate.py file is large (912 lines) and there are no automated tests, which is typical for community Home Assistant integrations.