homeassistant module is the main entry point for Home Assistant Core. It provides the foundational components for the home automation framework.
Overview
Home Assistant is a home automation framework for observing the state of entities and reacting to changes. The core module provides:- Event System: Fire and listen to events throughout the system
- State Machine: Track and manage entity states
- Service Registry: Register and call services
- Config Entries: Manage integration configurations
- Integration Loader: Load and manage integrations
Core Components
The main components accessible through the homeassistant module:HomeAssistant Instance
TheHomeAssistant class is the root object that coordinates all home automation functionality. See Core APIs for details.
Event Bus
The event bus (EventBus) allows components to fire and listen for events. Events are the primary way components communicate with each other.
State Machine
The state machine (StateMachine) tracks the state of all entities in the system. It provides methods to get, set, and remove entity states.
Service Registry
The service registry (ServiceRegistry) manages all available services that can be called by users or automations.
Key Concepts
Entities
Entities are the fundamental building blocks in Home Assistant. Each entity has:- A unique entity ID (format:
domain.object_id) - A state (string value)
- Attributes (dictionary of additional data)
- A context (tracking who/what triggered changes)
Events
Events are fired when something happens in Home Assistant. Common events include:state_changed: When an entity’s state changesservice_registered: When a new service is registeredhomeassistant_start: When Home Assistant startshomeassistant_stop: When Home Assistant stops
Services
Services are callable actions that perform specific tasks. They are organized by domain and can accept parameters.Module Structure
Usage Example
Related Documentation
- Core APIs - Detailed documentation of core classes
- Config Entries - Configuration entry management
- Integration Loader - Integration loading system