Home Assistant Unofficial Reference 2024.12.1
homeassistant.setup Namespace Reference

Classes

class  EventComponentLoaded
 
class  SetupPhases
 

Functions

list[str] _async_process_dependencies (core.HomeAssistant hass, ConfigType config, loader.Integration integration)
 
bool _async_setup_component (core.HomeAssistant hass, str domain, ConfigType config)
 
None _async_when_setup (core.HomeAssistant hass, str component, Callable[[core.HomeAssistant, str], Awaitable[None]] when_setup_cb, bool start_event)
 
None _log_error_setup_error (HomeAssistant hass, str domain, loader.Integration|None integration, str msg, Exception|None exc_info=None)
 
dict[tuple[str, str|None], float] _setup_started (core.HomeAssistant hass)
 
defaultdict[str, defaultdict[str|None, defaultdict[SetupPhases, float]]] _setup_times (core.HomeAssistant hass)
 
Mapping[str|None, dict[SetupPhases, float]] async_get_domain_setup_times (core.HomeAssistant hass, str domain)
 
set[str] async_get_loaded_integrations (core.HomeAssistant hass)
 
dict[str, float] async_get_setup_timings (core.HomeAssistant hass)
 
None async_notify_setup_error (HomeAssistant hass, str component, str|None display_link=None)
 
Generator[None] async_pause_setup (core.HomeAssistant hass, SetupPhases phase)
 
ModuleType|None async_prepare_setup_platform (core.HomeAssistant hass, ConfigType hass_config, str domain, str platform_name)
 
None async_process_deps_reqs (core.HomeAssistant hass, ConfigType config, loader.Integration integration)
 
None async_set_domains_to_be_loaded (core.HomeAssistant hass, set[str] domains)
 
bool async_setup_component (core.HomeAssistant hass, str domain, ConfigType config)
 
Generator[None] async_start_setup (core.HomeAssistant hass, str integration, SetupPhases phase, str|None group=None)
 
None async_when_setup (core.HomeAssistant hass, str component, Callable[[core.HomeAssistant, str], Awaitable[None]] when_setup_cb)
 
None async_when_setup_or_start (core.HomeAssistant hass, str component, Callable[[core.HomeAssistant, str], Awaitable[None]] when_setup_cb)
 
bool setup_component (core.HomeAssistant hass, str domain, ConfigType config)
 

Variables

 _LOGGER
 
 default
 
 Final
 
 NOTIFY_FOR_TRANSLATION_KEYS
 
 SLOW_SETUP_MAX_WAIT
 
 SLOW_SETUP_WARNING
 

Detailed Description

All methods needed to bootstrap a Home Assistant instance.

Function Documentation

◆ _async_process_dependencies()

list[str] homeassistant.setup._async_process_dependencies ( core.HomeAssistant  hass,
ConfigType  config,
loader.Integration   integration 
)
private
Ensure all dependencies are set up.

Returns a list of dependencies which failed to set up.

Definition at line 190 of file setup.py.

◆ _async_setup_component()

bool homeassistant.setup._async_setup_component ( core.HomeAssistant  hass,
str  domain,
ConfigType   config 
)
private
Set up a component for Home Assistant.

This method is a coroutine.

Definition at line 273 of file setup.py.

◆ _async_when_setup()

None homeassistant.setup._async_when_setup ( core.HomeAssistant  hass,
str  component,
Callable[[core.HomeAssistant, str], Awaitable[None]]  when_setup_cb,
bool  start_event 
)
private
Call a method when a component is setup or the start event fires.

Definition at line 603 of file setup.py.

◆ _log_error_setup_error()

None homeassistant.setup._log_error_setup_error ( HomeAssistant  hass,
str  domain,
loader.Integration | None  integration,
str  msg,
Exception | None   exc_info = None 
)
private
Log helper.

Definition at line 255 of file setup.py.

◆ _setup_started()

dict[tuple[str, str | None], float] homeassistant.setup._setup_started ( core.HomeAssistant  hass)
private
Return the setup started dict.

Definition at line 683 of file setup.py.

◆ _setup_times()

defaultdict[str, defaultdict[str | None, defaultdict[SetupPhases, float]]] homeassistant.setup._setup_times ( core.HomeAssistant  hass)
private
Return the setup timings default dict.

Definition at line 726 of file setup.py.

◆ async_get_domain_setup_times()

Mapping[str | None, dict[SetupPhases, float]] homeassistant.setup.async_get_domain_setup_times ( core.HomeAssistant  hass,
str   domain 
)
Return timing data for each integration.

Definition at line 820 of file setup.py.

◆ async_get_loaded_integrations()

set[str] homeassistant.setup.async_get_loaded_integrations ( core.HomeAssistant  hass)
Return the complete list of loaded integrations.

Definition at line 651 of file setup.py.

◆ async_get_setup_timings()

dict[str, float] homeassistant.setup.async_get_setup_timings ( core.HomeAssistant  hass)
Return timing data for each integration.

Definition at line 798 of file setup.py.

◆ async_notify_setup_error()

None homeassistant.setup.async_notify_setup_error ( HomeAssistant  hass,
str  component,
str | None   display_link = None 
)
Print a persistent notification.

This method must be run in the event loop.

Definition at line 97 of file setup.py.

◆ async_pause_setup()

Generator[None] homeassistant.setup.async_pause_setup ( core.HomeAssistant  hass,
SetupPhases  phase 
)
Keep track of time we are blocked waiting for other operations.

We want to count the time we wait for importing and
setting up the base components so we can subtract it
from the total setup time.

Definition at line 691 of file setup.py.

◆ async_prepare_setup_platform()

ModuleType | None homeassistant.setup.async_prepare_setup_platform ( core.HomeAssistant  hass,
ConfigType  hass_config,
str  domain,
str   platform_name 
)
Load a platform and makes sure dependencies are setup.

This method is a coroutine.

Definition at line 485 of file setup.py.

◆ async_process_deps_reqs()

None homeassistant.setup.async_process_deps_reqs ( core.HomeAssistant  hass,
ConfigType  config,
loader.Integration   integration 
)
Process all dependencies and requirements for a module.

Module is a Python module of either a component or platform.

Definition at line 559 of file setup.py.

◆ async_set_domains_to_be_loaded()

None homeassistant.setup.async_set_domains_to_be_loaded ( core.HomeAssistant  hass,
set[str]  domains 
)
Set domains that are going to be loaded from the config.

This allow us to:
 - Properly handle after_dependencies.
 - Keep track of domains which will load but have not yet finished loading

Definition at line 127 of file setup.py.

◆ async_setup_component()

bool homeassistant.setup.async_setup_component ( core.HomeAssistant  hass,
str  domain,
ConfigType   config 
)
Set up a component and all its dependencies.

This method is a coroutine.

Definition at line 145 of file setup.py.

◆ async_start_setup()

Generator[None] homeassistant.setup.async_start_setup ( core.HomeAssistant  hass,
str  integration,
SetupPhases  phase,
str | None   group = None 
)
Keep track of when setup starts and finishes.

:param hass: Home Assistant instance
:param integration: The integration that is being setup
:param phase: The phase of setup
:param group: The group (config entry/platform instance) that is being setup

  A group is a group of setups that run in parallel.

Definition at line 734 of file setup.py.

◆ async_when_setup()

None homeassistant.setup.async_when_setup ( core.HomeAssistant  hass,
str  component,
Callable[[core.HomeAssistant, str], Awaitable[None]]  when_setup_cb 
)
Call a method when a component is setup.

Definition at line 583 of file setup.py.

◆ async_when_setup_or_start()

None homeassistant.setup.async_when_setup_or_start ( core.HomeAssistant  hass,
str  component,
Callable[[core.HomeAssistant, str], Awaitable[None]]  when_setup_cb 
)
Call a method when a component is setup or state is fired.

Definition at line 593 of file setup.py.

◆ setup_component()

bool homeassistant.setup.setup_component ( core.HomeAssistant  hass,
str  domain,
ConfigType  config 
)
Set up a component and all its dependencies.

Definition at line 138 of file setup.py.

Variable Documentation

◆ _LOGGER

homeassistant.setup._LOGGER
private

Definition at line 43 of file setup.py.

◆ default

homeassistant.setup.default

Definition at line 39 of file setup.py.

◆ Final

homeassistant.setup.Final

Definition at line 45 of file setup.py.

◆ NOTIFY_FOR_TRANSLATION_KEYS

homeassistant.setup.NOTIFY_FOR_TRANSLATION_KEYS

Definition at line 81 of file setup.py.

◆ SLOW_SETUP_MAX_WAIT

homeassistant.setup.SLOW_SETUP_MAX_WAIT

Definition at line 87 of file setup.py.

◆ SLOW_SETUP_WARNING

homeassistant.setup.SLOW_SETUP_WARNING

Definition at line 86 of file setup.py.