Home Assistant Unofficial Reference 2024.12.1
homeassistant.loader Namespace Reference

Classes

class  BlockedIntegration
 
class  BluetoothMatcher
 
class  BluetoothMatcherOptional
 
class  BluetoothMatcherRequired
 
class  CircularDependency
 
class  ComponentProtocol
 
class  Components
 
class  DHCPMatcher
 
class  DHCPMatcherOptional
 
class  DHCPMatcherRequired
 
class  Helpers
 
class  HomeKitDiscoveredIntegration
 
class  Integration
 
class  IntegrationNotFound
 
class  IntegrationNotLoaded
 
class  LoaderError
 
class  Manifest
 
class  ModuleWrapper
 
class  USBMatcher
 
class  USBMatcherOptional
 
class  USBMatcherRequired
 
class  ZeroconfMatcher
 

Functions

set[str] _async_component_dependencies (HomeAssistant hass, Integration integration)
 
None _async_mount_config_dir (HomeAssistant hass)
 
def _CallableT
 
dict[str, Integration_get_custom_components (HomeAssistant hass)
 
ComponentProtocol|None _load_file (HomeAssistant hass, str comp_or_platform, list[str] base_paths)
 
list[str] _lookup_path (HomeAssistant hass)
 
dict[str, Integration_resolve_integrations_from_root (HomeAssistant hass, ModuleType root_module, Iterable[str] domains)
 
bool _version_blocked (AwesomeVersion integration_version, BlockedIntegration blocked_integration)
 
list[str] async_get_application_credentials (HomeAssistant hass)
 
list[BluetoothMatcherasync_get_bluetooth (HomeAssistant hass)
 
set[str] async_get_config_flows (HomeAssistant hass, Literal["device", "helper", "hub", "service"]|None type_filter=None)
 
dict[str, Integrationasync_get_custom_components (HomeAssistant hass)
 
list[DHCPMatcherasync_get_dhcp (HomeAssistant hass)
 
dict[str, HomeKitDiscoveredIntegrationasync_get_homekit (HomeAssistant hass)
 
Integration async_get_integration (HomeAssistant hass, str domain)
 
dict[str, Any] async_get_integration_descriptions (HomeAssistant hass)
 
dict[str, Integration|Exception] async_get_integrations (HomeAssistant hass, Iterable[str] domains)
 
Integration|None async_get_issue_integration (HomeAssistant|None hass, str|None integration_domain)
 
str|None async_get_issue_tracker (HomeAssistant|None hass, *Integration|None integration=None, str|None integration_domain=None, str|None module=None)
 
Integration async_get_loaded_integration (HomeAssistant hass, str domain)
 
dict[str, list[str]] async_get_mqtt (HomeAssistant hass)
 
dict[str, list[dict[str, str]]] async_get_ssdp (HomeAssistant hass)
 
list[USBMatcherasync_get_usb (HomeAssistant hass)
 
dict[str, list[ZeroconfMatcher]] async_get_zeroconf (HomeAssistant hass)
 
ZeroconfMatcher async_process_zeroconf_match_dict (dict[str, Any] entry)
 
None async_register_preload_platform (HomeAssistant hass, str platform_name)
 
None async_setup (HomeAssistant hass)
 
str async_suggest_report_issue (HomeAssistant|None hass, *Integration|None integration=None, str|None integration_domain=None, str|None module=None)
 
bool homekit_always_discover (str|None iot_class)
 
bool is_component_module_loaded (HomeAssistant hass, str module)
 
Manifest manifest_from_legacy_module (str domain, ModuleType module)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
list BASE_PRELOAD_PLATFORMS
 
tuple CUSTOM_WARNING
 
tuple IMPORT_EVENT_LOOP_WARNING
 
tuple MOVED_ZEROCONF_PROPS = ("macaddress", "model", "manufacturer")
 
string PACKAGE_BUILTIN = "homeassistant.components"
 
string PACKAGE_CUSTOM_COMPONENTS = "custom_components"
 

Detailed Description

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.

Function Documentation

◆ _async_component_dependencies()

set[str] homeassistant.loader._async_component_dependencies ( HomeAssistant  hass,
Integration  integration 
)
private
Get component dependencies.

Definition at line 1620 of file loader.py.

◆ _async_mount_config_dir()

None homeassistant.loader._async_mount_config_dir ( HomeAssistant  hass)
private
Mount config dir in order to load custom_component.

Async friendly but not a coroutine.

Definition at line 1664 of file loader.py.

◆ _CallableT()

def homeassistant.loader._CallableT
private

Definition at line 1610 of file loader.py.

◆ _get_custom_components()

dict[str, Integration] homeassistant.loader._get_custom_components ( HomeAssistant  hass)
private
Return list of custom integrations.

Definition at line 286 of file loader.py.

◆ _load_file()

ComponentProtocol | None homeassistant.loader._load_file ( HomeAssistant  hass,
str  comp_or_platform,
list[str]   base_paths 
)
private
Try to load specified file.

Looks in config dir first, then built-in components.
Only returns it if also found to be valid.
Async friendly.

Definition at line 1469 of file loader.py.

◆ _lookup_path()

list[str] homeassistant.loader._lookup_path ( HomeAssistant  hass)
private
Return the lookup paths for legacy lookups.

Definition at line 1677 of file loader.py.

◆ _resolve_integrations_from_root()

dict[str, Integration] homeassistant.loader._resolve_integrations_from_root ( HomeAssistant  hass,
ModuleType  root_module,
Iterable[str]   domains 
)
private
Resolve multiple integrations from root.

Definition at line 1324 of file loader.py.

◆ _version_blocked()

bool homeassistant.loader._version_blocked ( AwesomeVersion  integration_version,
BlockedIntegration  blocked_integration 
)
private
Return True if the integration version is blocked.

Definition at line 1310 of file loader.py.

◆ async_get_application_credentials()

list[str] homeassistant.loader.async_get_application_credentials ( HomeAssistant  hass)
Return cached list of application credentials.

Definition at line 453 of file loader.py.

◆ async_get_bluetooth()

list[BluetoothMatcher] homeassistant.loader.async_get_bluetooth ( HomeAssistant  hass)
Return cached list of bluetooth types.

Definition at line 515 of file loader.py.

◆ async_get_config_flows()

set[str] homeassistant.loader.async_get_config_flows ( HomeAssistant  hass,
Literal["device", "helper", "hub", "service"] | None   type_filter = None 
)
Return cached list of config flows.

Definition at line 336 of file loader.py.

◆ async_get_custom_components()

dict[str, Integration] homeassistant.loader.async_get_custom_components ( HomeAssistant  hass)
Return cached list of custom integrations.

Definition at line 315 of file loader.py.

◆ async_get_dhcp()

list[DHCPMatcher] homeassistant.loader.async_get_dhcp ( HomeAssistant  hass)
Return cached list of dhcp types.

Definition at line 531 of file loader.py.

◆ async_get_homekit()

dict[str, HomeKitDiscoveredIntegration] homeassistant.loader.async_get_homekit ( HomeAssistant  hass)
Return cached list of homekit models.

Definition at line 581 of file loader.py.

◆ async_get_integration()

Integration homeassistant.loader.async_get_integration ( HomeAssistant  hass,
str  domain 
)
Get integration.

Definition at line 1354 of file loader.py.

◆ async_get_integration_descriptions()

dict[str, Any] homeassistant.loader.async_get_integration_descriptions ( HomeAssistant  hass)
Return cached list of integrations.

Definition at line 406 of file loader.py.

◆ async_get_integrations()

dict[str, Integration | Exception] homeassistant.loader.async_get_integrations ( HomeAssistant  hass,
Iterable[str]   domains 
)
Get integrations.

Definition at line 1366 of file loader.py.

◆ async_get_issue_integration()

Integration | None homeassistant.loader.async_get_issue_integration ( HomeAssistant | None  hass,
str | None  integration_domain 
)
Return details of an integration for issue reporting.

Definition at line 1690 of file loader.py.

◆ async_get_issue_tracker()

str | None homeassistant.loader.async_get_issue_tracker ( HomeAssistant | None  hass,
*Integration | None   integration = None,
str | None   integration_domain = None,
str | None   module = None 
)
Return a URL for an integration's issue tracker.

Definition at line 1713 of file loader.py.

◆ async_get_loaded_integration()

Integration homeassistant.loader.async_get_loaded_integration ( HomeAssistant  hass,
str  domain 
)
Get an integration which is already loaded.

Raises IntegrationNotLoaded if the integration is not loaded.

Definition at line 1341 of file loader.py.

◆ async_get_mqtt()

dict[str, list[str]] homeassistant.loader.async_get_mqtt ( HomeAssistant  hass)
Return cached list of MQTT mappings.

Definition at line 624 of file loader.py.

◆ async_get_ssdp()

dict[str, list[dict[str, str]]] homeassistant.loader.async_get_ssdp ( HomeAssistant  hass)
Return cached list of ssdp mappings.

Definition at line 609 of file loader.py.

◆ async_get_usb()

list[USBMatcher] homeassistant.loader.async_get_usb ( HomeAssistant  hass)
Return cached list of usb types.

Definition at line 545 of file loader.py.

◆ async_get_zeroconf()

dict[str, list[ZeroconfMatcher]] homeassistant.loader.async_get_zeroconf ( HomeAssistant  hass)
Return cached list of zeroconf types.

Definition at line 492 of file loader.py.

◆ async_process_zeroconf_match_dict()

ZeroconfMatcher homeassistant.loader.async_process_zeroconf_match_dict ( dict[str, Any]  entry)
Handle backwards compat with zeroconf matchers.

Definition at line 467 of file loader.py.

◆ async_register_preload_platform()

None homeassistant.loader.async_register_preload_platform ( HomeAssistant  hass,
str  platform_name 
)
Register a platform to be preloaded.

Definition at line 640 of file loader.py.

◆ async_setup()

None homeassistant.loader.async_setup ( HomeAssistant  hass)
Set up the necessary data structures.

Definition at line 266 of file loader.py.

◆ async_suggest_report_issue()

str homeassistant.loader.async_suggest_report_issue ( HomeAssistant | None  hass,
*Integration | None   integration = None,
str | None   integration_domain = None,
str | None   module = None 
)
Generate a blurb asking the user to file a bug report.

Definition at line 1746 of file loader.py.

◆ homekit_always_discover()

bool homeassistant.loader.homekit_always_discover ( str | None  iot_class)
Return if we should always offer HomeKit control for a device.

Definition at line 567 of file loader.py.

◆ is_component_module_loaded()

bool homeassistant.loader.is_component_module_loaded ( HomeAssistant  hass,
str  module 
)
Test if a component module is loaded.

Definition at line 1684 of file loader.py.

◆ manifest_from_legacy_module()

Manifest homeassistant.loader.manifest_from_legacy_module ( str  domain,
ModuleType  module 
)
Generate a manifest from a legacy module.

Definition at line 275 of file loader.py.

Variable Documentation

◆ _LOGGER

homeassistant.loader._LOGGER = logging.getLogger(__name__)
private

Definition at line 54 of file loader.py.

◆ BASE_PRELOAD_PLATFORMS

list homeassistant.loader.BASE_PRELOAD_PLATFORMS
Initial value:
1 = [
2  "config",
3  "config_flow",
4  "diagnostics",
5  "energy",
6  "group",
7  "logbook",
8  "hardware",
9  "intent",
10  "media_source",
11  "recorder",
12  "repairs",
13  "system_health",
14  "trigger",
15 ]

Definition at line 67 of file loader.py.

◆ CUSTOM_WARNING

tuple homeassistant.loader.CUSTOM_WARNING
Initial value:
1 = (
2  "We found a custom integration %s which has not "
3  "been tested by Home Assistant. This component might "
4  "cause stability problems, be sure to disable it if you "
5  "experience issues with Home Assistant"
6 )

Definition at line 137 of file loader.py.

◆ IMPORT_EVENT_LOOP_WARNING

tuple homeassistant.loader.IMPORT_EVENT_LOOP_WARNING
Initial value:
1 = (
2  "We found an integration %s which is configured to "
3  "to import its code in the event loop. This component might "
4  "cause stability problems, be sure to disable it if you "
5  "experience issues with Home Assistant"
6 )

Definition at line 143 of file loader.py.

◆ MOVED_ZEROCONF_PROPS

tuple homeassistant.loader.MOVED_ZEROCONF_PROPS = ("macaddress", "model", "manufacturer")

Definition at line 150 of file loader.py.

◆ PACKAGE_BUILTIN

string homeassistant.loader.PACKAGE_BUILTIN = "homeassistant.components"

Definition at line 136 of file loader.py.

◆ PACKAGE_CUSTOM_COMPONENTS

string homeassistant.loader.PACKAGE_CUSTOM_COMPONENTS = "custom_components"

Definition at line 135 of file loader.py.