Skip to main content
The homeassistant.loader module provides the integration loading system that discovers, validates, and loads integrations.

Integration Class

The Integration class represents a loaded integration and provides access to its components and metadata.

Attributes

str
Domain name of the integration
str
Human-readable name from the manifest
str
Python package path (e.g., “homeassistant.components.light”)
pathlib.Path
Filesystem path to the integration
Manifest
The integration’s manifest.json contents
list[str]
List of domains this integration depends on
list[str]
List of Python package requirements
AwesomeVersion | None
Version of the integration (for custom integrations)
bool
Whether this is a built-in integration
bool
Whether the integration has a config flow
str | None
URL to the integration’s documentation
str
Type of integration (entity, device, hub, service, helper, system, virtual)
str | None
IoT class of the integration (cloud_polling, cloud_push, local_polling, local_push, etc.)
str | None
Quality scale rating (internal, silver, gold, platinum)

Methods

async_get_component()

Load and return the integration’s main component.
ComponentProtocol
The loaded component module

async_get_platform(platform_name)

Load and return a specific platform.
str
required
Name of the platform to load
ModuleType
The loaded platform module

async_get_platforms(platform_names)

Load multiple platforms at once.
Iterable[str]
required
Names of platforms to load
dict[str, ModuleType]
Dictionary mapping platform names to loaded modules

get_component()

Synchronously get the component (thread-safe).
This method is thread-safe but should generally be avoided in favor of async_get_component() in async code.

get_platform(platform_name)

Synchronously get a platform (thread-safe).

Loading Functions

async_get_integration(hass, domain)

Get an integration by domain.
HomeAssistant
required
Home Assistant instance
str
required
Domain of the integration to load
Integration
The loaded integration
Raises IntegrationNotFound if the integration doesn’t exist.

async_get_integrations(hass, domains)

Get multiple integrations at once.
HomeAssistant
required
Home Assistant instance
Iterable[str]
required
List of domains to load
dict[str, Integration | Exception]
Dictionary mapping domains to Integration objects or exceptions

async_get_custom_components(hass)

Get all custom integrations.
dict[str, Integration]
Dictionary of custom integrations by domain

async_get_config_flows(hass, type_filter=None)

Get all integrations that support config flows.
HomeAssistant
required
Home Assistant instance
str
Filter by integration type (device, helper, hub, service)
set[str]
Set of domain names that support config flows

Manifest Structure

The manifest.json file defines integration metadata:

Manifest Fields

str
required
Unique domain identifier (must match directory name)
str
required
Human-readable name
list[str]
GitHub usernames of code owners
bool
default:"false"
Whether the integration supports config flows
list[str]
List of integration domains this depends on
list[str]
Integrations to load before this one (soft dependencies)
list[str]
Python package requirements (with versions)
str
URL to documentation
str
One of: entity, device, hardware, helper, hub, service, system, virtual
str
IoT class: cloud_polling, cloud_push, local_polling, local_push, assumed, calculated
str
Quality scale: internal, silver, gold, platinum
str
Version string (required for custom integrations)
bool
default:"false"
Whether only one config entry is allowed
bool
default:"true"
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.
HomeAssistant
required
Home Assistant instance
ConfigType
required
Configuration dictionary
bool
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

Set import_executor: true in manifest for integrations with blocking imports:

Specify Dependencies

Always declare integration dependencies: