homeassistant.loader

The methods for loading Home Assistant integrations.

This module has quite some complex parts. I have tried to add as much documentation as possible to keep it understandable.

exception homeassistant.loader.CircularDependency(from_domain: str, to_domain: str)[source]

Raised when a circular dependency is found when resolving components.

class homeassistant.loader.Components(hass: HomeAssistant)[source]

Helper to load components.

class homeassistant.loader.Helpers(hass: HomeAssistant)[source]

Helper to load helpers.

class homeassistant.loader.Integration(hass: HomeAssistant, pkg_path: str, file_path: pathlib.Path, manifest: Manifest)[source]

An integration in Home Assistant.

property after_dependencies

Return after_dependencies.

property all_dependencies

Return all dependencies including sub-dependencies.

property all_dependencies_resolved

Return if all dependencies have been resolved.

property config_flow

Return config_flow.

property dependencies

Return dependencies.

property dhcp

Return Integration dhcp entries.

property disabled

Return reason integration is disabled.

property documentation

Return documentation.

property domain

Return domain.

get_component() → module[source]

Return the component.

get_platform(platform_name: str) → module[source]

Return a platform for an integration.

property homekit

Return Integration homekit entries.

property is_built_in

Test if package is a built-in integration.

property issue_tracker

Return issue tracker link.

property mqtt

Return Integration MQTT entries.

property name

Return name.

property quality_scale

Return Integration Quality Scale.

property requirements

Return requirements.

async resolve_dependencies() → bool[source]

Resolve all dependencies.

classmethod resolve_from_root(hass: HomeAssistant, root_module: ModuleType, domain: str) → Integration | None[source]

Resolve an integration from a root module.

classmethod resolve_legacy(hass: HomeAssistant, domain: str) → Integration | None[source]

Resolve legacy component.

Will create a stub manifest.

property ssdp

Return Integration SSDP entries.

property version

Return the version of the integration.

property zeroconf

Return Integration zeroconf entries.

exception homeassistant.loader.IntegrationNotFound(domain: str)[source]

Raised when a component is not found.

exception homeassistant.loader.LoaderError[source]

Loader base error.

class homeassistant.loader.Manifest[source]

Integration manifest.

Note that none of the attributes are marked Optional here. However, some of them may be optional in manifest.json in the sense that they can be omitted altogether. But when present, they should not have null values in it.

class homeassistant.loader.ModuleWrapper(hass: HomeAssistant, module: ModuleType)[source]

Class to wrap a Python module and auto fill in hass argument.

async homeassistant.loader.async_get_config_flows(hass: HomeAssistant) → set[str][source]

Return cached list of config flows.

async homeassistant.loader.async_get_custom_components(hass: HomeAssistant) → dict[str, Integration][source]

Return cached list of custom integrations.

async homeassistant.loader.async_get_dhcp(hass: HomeAssistant) → list[dict[str, str]][source]

Return cached list of dhcp types.

async homeassistant.loader.async_get_homekit(hass: HomeAssistant) → dict[str, str][source]

Return cached list of homekit models.

async homeassistant.loader.async_get_integration(hass: HomeAssistant, domain: str) → Integration[source]

Get an integration.

async homeassistant.loader.async_get_mqtt(hass: HomeAssistant) → dict[str, list[str]][source]

Return cached list of MQTT mappings.

async homeassistant.loader.async_get_ssdp(hass: HomeAssistant) → dict[str, list[dict[str, str]]][source]

Return cached list of ssdp mappings.

async homeassistant.loader.async_get_zeroconf(hass: HomeAssistant) → dict[str, list[dict[str, str]]][source]

Return cached list of zeroconf types.

homeassistant.loader.bind_hass(func: CALLABLE_T) → CALLABLE_T[source]

Decorate function to indicate that first argument is hass.

homeassistant.loader.custom_integration_warning(integration: homeassistant.loader.Integration) → None[source]

Create logs for custom integrations.

homeassistant.loader.manifest_from_legacy_module(domain: str, module: module) → homeassistant.loader.Manifest[source]

Generate a manifest from a legacy module.

homeassistant.loader.validate_custom_integration_version(version: str) → bool[source]

Validate the version of custom integrations.