Home Assistant Unofficial Reference 2024.12.1
homeassistant.loader.Integration Class Reference

Public Member Functions

None __init__ (self, HomeAssistant hass, str pkg_path, pathlib.Path file_path, Manifest manifest, set[str]|None top_level_files=None)
 
str __repr__ (self)
 
list[str] after_dependencies (self)
 
set[str] all_dependencies (self)
 
bool all_dependencies_resolved (self)
 
ComponentProtocol async_get_component (self)
 
ModuleType async_get_platform (self, str platform_name)
 
dict[str, ModuleType] async_get_platforms (self, Iterable[Platform|str] platform_names)
 
list[dict[str, str|int]]|None bluetooth (self)
 
bool config_flow (self)
 
list[str] dependencies (self)
 
list[dict[str, str|bool]]|None dhcp (self)
 
str|None disabled (self)
 
str|None documentation (self)
 
str domain (self)
 
ComponentProtocol get_component (self)
 
ModuleType get_platform (self, str platform_name)
 
ModuleType|None get_platform_cached (self, str platform_name)
 
bool has_services (self)
 
bool has_translations (self)
 
dict[str, list[str]]|None homekit (self)
 
bool import_executor (self)
 
Literal[ "entity", "device", "hardware", "helper", "hub", "service", "system", "virtual"] integration_type (self)
 
str|None iot_class (self)
 
bool is_built_in (self)
 
str|None issue_tracker (self)
 
list[str]|None loggers (self)
 
json_fragment manifest_json_fragment (self)
 
list[str]|None mqtt (self)
 
str name (self)
 
bool overwrites_built_in (self)
 
bool platforms_are_loaded (self, Iterable[str] platform_names)
 
list[str] platforms_exists (self, Iterable[str] platform_names)
 
str|None quality_scale (self)
 
list[str] requirements (self)
 
bool resolve_dependencies (self)
 
Integration|None resolve_from_root (cls, HomeAssistant hass, ModuleType root_module, str domain)
 
bool single_config_entry (self)
 
list[dict[str, str]]|None ssdp (self)
 
list[dict[str, str]]|None usb (self)
 
AwesomeVersion|None version (self)
 
list[str|dict[str, str]]|None zeroconf (self)
 

Public Attributes

 file_path
 
 hass
 
 manifest
 
 pkg_path
 

Private Member Functions

ComponentProtocol _get_component (self, bool preload_platforms=False)
 
ModuleType|None _get_platform_cached_or_raise (self, str platform_name)
 
ModuleType _import_platform (self, str platform_name)
 
ModuleType _load_platform (self, str platform_name)
 
dict[str, ModuleType] _load_platforms (self, Iterable[str] platform_names)
 

Private Attributes

 _all_dependencies
 
 _all_dependencies_resolved
 
 _cache
 
 _component_future
 
 _missing_platforms_cache
 
 _platforms_to_preload
 
 _top_level_files
 

Detailed Description

An integration in Home Assistant.

Definition at line 647 of file loader.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.loader.Integration.__init__ (   self,
HomeAssistant  hass,
str  pkg_path,
pathlib.Path  file_path,
Manifest  manifest,
set[str] | None   top_level_files = None 
)
Initialize an integration.

Definition at line 744 of file loader.py.

Member Function Documentation

◆ __repr__()

str homeassistant.loader.Integration.__repr__ (   self)
Text representation of class.

Definition at line 1305 of file loader.py.

◆ _get_component()

ComponentProtocol homeassistant.loader.Integration._get_component (   self,
bool   preload_platforms = False 
)
private
Return the component.

Definition at line 1068 of file loader.py.

◆ _get_platform_cached_or_raise()

ModuleType | None homeassistant.loader.Integration._get_platform_cached_or_raise (   self,
str  platform_name 
)
private
Return a platform for an integration from cache.

Definition at line 1206 of file loader.py.

◆ _import_platform()

ModuleType homeassistant.loader.Integration._import_platform (   self,
str  platform_name 
)
private
Import the platform.

This method must be thread-safe as it's called from the executor
and the event loop.

Definition at line 1297 of file loader.py.

◆ _load_platform()

ModuleType homeassistant.loader.Integration._load_platform (   self,
str  platform_name 
)
private
Load a platform for an integration.

This method must be thread-safe as it's called from the executor
and the event loop.

This is mostly a thin wrapper around importlib.import_module
with a dict cache which is thread-safe since importlib has
appropriate locks.

Definition at line 1258 of file loader.py.

◆ _load_platforms()

dict[str, ModuleType] homeassistant.loader.Integration._load_platforms (   self,
Iterable[str]  platform_names 
)
private
Load platforms for an integration.

Definition at line 1094 of file loader.py.

◆ after_dependencies()

list[str] homeassistant.loader.Integration.after_dependencies (   self)
Return after_dependencies.

Definition at line 801 of file loader.py.

◆ all_dependencies()

set[str] homeassistant.loader.Integration.all_dependencies (   self)
Return all dependencies including sub-dependencies.

Definition at line 932 of file loader.py.

◆ all_dependencies_resolved()

bool homeassistant.loader.Integration.all_dependencies_resolved (   self)
Return if all dependencies have been resolved.

Definition at line 940 of file loader.py.

◆ async_get_component()

ComponentProtocol homeassistant.loader.Integration.async_get_component (   self)
Return the component.

This method will load the component if it's not already loaded
and will check if import_executor is set and load it in the executor,
otherwise it will load it in the event loop.

Definition at line 978 of file loader.py.

◆ async_get_platform()

ModuleType homeassistant.loader.Integration.async_get_platform (   self,
str  platform_name 
)
Return a platform for an integration.

Definition at line 1101 of file loader.py.

◆ async_get_platforms()

dict[str, ModuleType] homeassistant.loader.Integration.async_get_platforms (   self,
Iterable[Platform | str]   platform_names 
)
Return a platforms for an integration.

Definition at line 1110 of file loader.py.

◆ bluetooth()

list[dict[str, str | int]] | None homeassistant.loader.Integration.bluetooth (   self)
Return Integration bluetooth entries.

Definition at line 885 of file loader.py.

◆ config_flow()

bool homeassistant.loader.Integration.config_flow (   self)
Return config_flow.

Definition at line 811 of file loader.py.

◆ dependencies()

list[str] homeassistant.loader.Integration.dependencies (   self)
Return dependencies.

Definition at line 796 of file loader.py.

◆ dhcp()

list[dict[str, str | bool]] | None homeassistant.loader.Integration.dhcp (   self)
Return Integration dhcp entries.

Definition at line 890 of file loader.py.

◆ disabled()

str | None homeassistant.loader.Integration.disabled (   self)
Return reason integration is disabled.

Definition at line 786 of file loader.py.

◆ documentation()

str | None homeassistant.loader.Integration.documentation (   self)
Return documentation.

Definition at line 816 of file loader.py.

◆ domain()

str homeassistant.loader.Integration.domain (   self)
Return domain.

Definition at line 791 of file loader.py.

◆ get_component()

ComponentProtocol homeassistant.loader.Integration.get_component (   self)
Return the component.

This method must be thread-safe as it's called from the executor
and the event loop.

This method checks the cache and if the component is not loaded
it will load it in the executor if import_executor is set, otherwise
it will load it in the event loop.

This is mostly a thin wrapper around importlib.import_module
with a dict cache which is thread-safe since importlib has
appropriate locks.

Definition at line 1049 of file loader.py.

◆ get_platform()

ModuleType homeassistant.loader.Integration.get_platform (   self,
str  platform_name 
)
Return a platform for an integration.

Definition at line 1231 of file loader.py.

◆ get_platform_cached()

ModuleType | None homeassistant.loader.Integration.get_platform_cached (   self,
str  platform_name 
)
Return a platform for an integration from cache.

Definition at line 1227 of file loader.py.

◆ has_services()

bool homeassistant.loader.Integration.has_services (   self)
Return if the integration has services.

Definition at line 865 of file loader.py.

◆ has_translations()

bool homeassistant.loader.Integration.has_translations (   self)
Return if the integration has translations.

Definition at line 860 of file loader.py.

◆ homekit()

dict[str, list[str]] | None homeassistant.loader.Integration.homekit (   self)
Return Integration homekit entries.

Definition at line 900 of file loader.py.

◆ import_executor()

bool homeassistant.loader.Integration.import_executor (   self)
Import integration in the executor.

Definition at line 853 of file loader.py.

◆ integration_type()

Literal[ "entity", "device", "hardware", "helper", "hub", "service", "system", "virtual" ] homeassistant.loader.Integration.integration_type (   self)
Return the integration type.

Definition at line 844 of file loader.py.

◆ iot_class()

str | None homeassistant.loader.Integration.iot_class (   self)
Return the integration IoT Class.

Definition at line 839 of file loader.py.

◆ is_built_in()

bool homeassistant.loader.Integration.is_built_in (   self)
Test if package is a built-in integration.

Definition at line 905 of file loader.py.

◆ issue_tracker()

str | None homeassistant.loader.Integration.issue_tracker (   self)
Return issue tracker link.

Definition at line 821 of file loader.py.

◆ loggers()

list[str] | None homeassistant.loader.Integration.loggers (   self)
Return list of loggers used by the integration.

Definition at line 826 of file loader.py.

◆ manifest_json_fragment()

json_fragment homeassistant.loader.Integration.manifest_json_fragment (   self)
Return manifest as a JSON fragment.

Definition at line 776 of file loader.py.

◆ mqtt()

list[str] | None homeassistant.loader.Integration.mqtt (   self)
Return Integration MQTT entries.

Definition at line 870 of file loader.py.

◆ name()

str homeassistant.loader.Integration.name (   self)
Return name.

Definition at line 781 of file loader.py.

◆ overwrites_built_in()

bool homeassistant.loader.Integration.overwrites_built_in (   self)
Return if package overwrites a built-in integration.

Definition at line 910 of file loader.py.

◆ platforms_are_loaded()

bool homeassistant.loader.Integration.platforms_are_loaded (   self,
Iterable[str]  platform_names 
)
Check if a platforms are loaded for an integration.

Definition at line 1220 of file loader.py.

◆ platforms_exists()

list[str] homeassistant.loader.Integration.platforms_exists (   self,
Iterable[str]  platform_names 
)
Check if a platforms exists for an integration.

This method is thread-safe and can be called from the executor
or event loop without doing blocking I/O.

Definition at line 1237 of file loader.py.

◆ quality_scale()

str | None homeassistant.loader.Integration.quality_scale (   self)
Return Integration Quality Scale.

Definition at line 831 of file loader.py.

◆ requirements()

list[str] homeassistant.loader.Integration.requirements (   self)
Return requirements.

Definition at line 806 of file loader.py.

◆ resolve_dependencies()

bool homeassistant.loader.Integration.resolve_dependencies (   self)
Resolve all dependencies.

Definition at line 944 of file loader.py.

◆ resolve_from_root()

Integration | None homeassistant.loader.Integration.resolve_from_root (   cls,
HomeAssistant  hass,
ModuleType  root_module,
str   domain 
)
Resolve an integration from a root module.

Definition at line 651 of file loader.py.

◆ single_config_entry()

bool homeassistant.loader.Integration.single_config_entry (   self)
Return if the integration supports a single config entry only.

Definition at line 927 of file loader.py.

◆ ssdp()

list[dict[str, str]] | None homeassistant.loader.Integration.ssdp (   self)
Return Integration SSDP entries.

Definition at line 875 of file loader.py.

◆ usb()

list[dict[str, str]] | None homeassistant.loader.Integration.usb (   self)
Return Integration usb entries.

Definition at line 895 of file loader.py.

◆ version()

AwesomeVersion | None homeassistant.loader.Integration.version (   self)
Return the version of the integration.

Definition at line 920 of file loader.py.

◆ zeroconf()

list[str | dict[str, str]] | None homeassistant.loader.Integration.zeroconf (   self)
Return Integration zeroconf entries.

Definition at line 880 of file loader.py.

Member Data Documentation

◆ _all_dependencies

homeassistant.loader.Integration._all_dependencies
private

Definition at line 765 of file loader.py.

◆ _all_dependencies_resolved

homeassistant.loader.Integration._all_dependencies_resolved
private

Definition at line 764 of file loader.py.

◆ _cache

homeassistant.loader.Integration._cache
private

Definition at line 770 of file loader.py.

◆ _component_future

homeassistant.loader.Integration._component_future
private

Definition at line 1011 of file loader.py.

◆ _missing_platforms_cache

homeassistant.loader.Integration._missing_platforms_cache
private

Definition at line 771 of file loader.py.

◆ _platforms_to_preload

homeassistant.loader.Integration._platforms_to_preload
private

Definition at line 767 of file loader.py.

◆ _top_level_files

homeassistant.loader.Integration._top_level_files
private

Definition at line 772 of file loader.py.

◆ file_path

homeassistant.loader.Integration.file_path

Definition at line 755 of file loader.py.

◆ hass

homeassistant.loader.Integration.hass

Definition at line 753 of file loader.py.

◆ manifest

homeassistant.loader.Integration.manifest

Definition at line 756 of file loader.py.

◆ pkg_path

homeassistant.loader.Integration.pkg_path

Definition at line 754 of file loader.py.


The documentation for this class was generated from the following file: