$ show home-assistant/core
Home Assistant Core is the open-source home automation platform that powers millions of smart homes. It provides a unified event-driven architecture for integrating, controlling, and automating IoT devices, services, and voice assistants. The system runs as a Python async application with a modular component system: each integration (e.g., lights, sensors, climate, locks) is a self-contained Python package under `homeassistant/components/`, following a consistent pattern of config entries, data update coordinators, and entity platforms. Key entry points include the CLI (`hass`), the web-based frontend (served via aiohttp), WebSocket API, and REST API. Data flows are event-driven: state changes, service calls, and automation triggers propagate through a central bus. External dependencies include hundreds of third-party libraries for device communication (BLE, Zigbee, Z-Wave, MQTT, HTTP), cloud services (Nabu Casa, Google Assistant, Alexa), and media playback (Cast, DLNA). The architecture is a monolith with a plugin system, not microservices, but supports horizontal scaling via separate instances and the 'recorder' component for persistent state history.
The LLM identified 5 files worth highlighting for reuse:
DataUpdateCoordinator is a generic base class that manages periodic data fetching from external APIs, handles refresh failures, and notifies dependent entities. It is used by hundreds of integrations and can be extracted as a standalone library for any async Python project needing coordinated data updates with backoff and error handling.
Provides `async_redact_data` and `async_check_can_reach_url` utilities for safely exposing diagnostic information. The redaction function recursively traverses dicts/lists and replaces sensitive keys with a placeholder. This is a self-contained, reusable pattern for any application that needs to expose debug data without leaking secrets.
A ReadOnlyDict class that wraps a regular dict and raises TypeError on mutation attempts. It provides a frozen view of data for safe sharing between async tasks without copying. This is a clean, dependency-free utility that can be reused in any Python project needing immutable dictionaries.
Implements the Blueprint model for automations and scripts, including YAML-based templates with input validation, schema enforcement, and substitution. The design separates blueprint definition from instantiation, making it reusable for any system that needs user-customizable templates with strict validation.
BackupManager orchestrates backup creation, restoration, and agent management (local, cloud, S3, etc.) using a state machine pattern. It handles concurrent operations, progress tracking, and error recovery. The agent abstraction allows pluggable storage backends and can be extracted for any application needing a robust backup system.