homeassistant.loader module provides the integration loading system that discovers, validates, and loads integrations.
Integration Class
TheIntegration class represents a loaded integration and provides access to its components and metadata.
Attributes
Domain name of the integration
Human-readable name from the manifest
Python package path (e.g., “homeassistant.components.light”)
Filesystem path to the integration
The integration’s manifest.json contents
List of domains this integration depends on
List of Python package requirements
Version of the integration (for custom integrations)
Whether this is a built-in integration
Whether the integration has a config flow
URL to the integration’s documentation
Type of integration (entity, device, hub, service, helper, system, virtual)
IoT class of the integration (cloud_polling, cloud_push, local_polling, local_push, etc.)
Quality scale rating (internal, silver, gold, platinum)
Methods
async_get_component()
Load and return the integration’s main component.The loaded component module
async_get_platform(platform_name)
Load and return a specific platform.Name of the platform to load
The loaded platform module
async_get_platforms(platform_names)
Load multiple platforms at once.Names of platforms to load
Dictionary mapping platform names to loaded modules
get_component()
Synchronously get the component (thread-safe).get_platform(platform_name)
Synchronously get a platform (thread-safe).Loading Functions
async_get_integration(hass, domain)
Get an integration by domain.Home Assistant instance
Domain of the integration to load
The loaded integration
Raises
IntegrationNotFound if the integration doesn’t exist.async_get_integrations(hass, domains)
Get multiple integrations at once.Home Assistant instance
List of domains to load
Dictionary mapping domains to Integration objects or exceptions
async_get_custom_components(hass)
Get all custom integrations.Dictionary of custom integrations by domain
async_get_config_flows(hass, type_filter=None)
Get all integrations that support config flows.Home Assistant instance
Filter by integration type (device, helper, hub, service)
Set of domain names that support config flows
Manifest Structure
Themanifest.json file defines integration metadata:
Manifest Fields
Unique domain identifier (must match directory name)
Human-readable name
GitHub usernames of code owners
Whether the integration supports config flows
List of integration domains this depends on
Integrations to load before this one (soft dependencies)
Python package requirements (with versions)
URL to documentation
One of: entity, device, hardware, helper, hub, service, system, virtual
IoT class: cloud_polling, cloud_push, local_polling, local_push, assumed, calculated
Quality scale: internal, silver, gold, platinum
Version string (required for custom integrations)
Whether only one config entry is allowed
Whether to import the integration in the executor
Component Protocol
Integrations can implement these methods to support various features:async_setup(hass, config)
Set up the integration from YAML configuration.Home Assistant instance
Configuration dictionary
True if setup succeeded
async_setup_entry(hass, entry)
Set up from a config entry.async_unload_entry(hass, entry)
Unload a config entry.async_remove_entry(hass, entry)
Called when a config entry is removed.async_migrate_entry(hass, entry)
Migrate a config entry to a new version.Discovery Integration Types
Bluetooth
Integrations can be discovered via Bluetooth:Zeroconf
Discovery via Zeroconf/mDNS:SSDP
Discovery via SSDP:USB
Discovery via USB:Error Handling
IntegrationNotFound
Raised when an integration cannot be found:Best Practices
Cache Integration References
Cache integration references to avoid repeated lookups:Use Executor for Blocking Code
Setimport_executor: true in manifest for integrations with blocking imports: