Home Assistant Unofficial Reference 2024.12.1
homeassistant.config_entries.ConfigEntries Class Reference

Public Member Functions

None __init__ (self, HomeAssistant hass, ConfigType hass_config)
 
None async_add (self, ConfigEntry entry)
 
list[str] async_domains (self, bool include_ignore=False, bool include_disabled=False)
 
list[ConfigEntryasync_entries (self, str|None domain=None, bool include_ignore=True, bool include_disabled=True)
 
ConfigEntry|None async_entry_for_domain_unique_id (self, str domain, str unique_id)
 
list[str] async_entry_ids (self)
 
bool async_forward_entry_setup (self, ConfigEntry entry, Platform|str domain)
 
None async_forward_entry_setups (self, ConfigEntry entry, Iterable[Platform|str] platforms)
 
bool async_forward_entry_unload (self, ConfigEntry entry, Platform|str domain)
 
ConfigEntry|None async_get_entry (self, str entry_id)
 
ConfigEntry async_get_known_entry (self, str entry_id)
 
bool async_has_entries (self, str domain, bool include_ignore=True, bool include_disabled=True)
 
None async_initialize (self)
 
list[ConfigEntryasync_loaded_entries (self, str domain)
 
bool async_reload (self, str entry_id)
 
dict[str, Any] async_remove (self, str entry_id)
 
None async_schedule_reload (self, str entry_id)
 
bool async_set_disabled_by (self, str entry_id, ConfigEntryDisabler|None disabled_by)
 
bool async_setup (self, str entry_id, bool _lock=True)
 
bool async_unload (self, str entry_id, bool _lock=True)
 
bool async_unload_platforms (self, ConfigEntry entry, Iterable[Platform|str] platforms)
 
bool async_update_entry (self, ConfigEntry entry, *Mapping[str, Any]|UndefinedType data=UNDEFINED, MappingProxyType[str, tuple[DiscoveryKey,...]]|UndefinedType discovery_keys=UNDEFINED, int|UndefinedType minor_version=UNDEFINED, Mapping[str, Any]|UndefinedType options=UNDEFINED, bool|UndefinedType pref_disable_new_entities=UNDEFINED, bool|UndefinedType pref_disable_polling=UNDEFINED, str|UndefinedType title=UNDEFINED, str|None|UndefinedType unique_id=UNDEFINED, int|UndefinedType version=UNDEFINED)
 
None async_update_issues (self)
 
bool async_wait_component (self, ConfigEntry entry)
 

Public Attributes

 flow
 
 hass
 
 options
 

Private Member Functions

None _async_clean_up (self, ConfigEntry entry)
 
None _async_dispatch (self, ConfigEntryChange change_type, ConfigEntry entry)
 
bool _async_forward_entry_setup (self, ConfigEntry entry, Platform|str domain, bool preload_platform)
 
None _async_forward_entry_setups_locked (self, ConfigEntry entry, Iterable[Platform|str] platforms)
 
tuple[bool, ConfigEntry_async_remove (self, str entry_id)
 
None _async_schedule_save (self)
 
None _async_shutdown (self, Event event)
 
dict[str, list[dict[str, Any]]] _data_to_save (self)
 

Private Attributes

 _entries
 
 _hass_config
 
 _store
 

Detailed Description

Manage the configuration entries.

An instance of this object is available via `hass.config_entries`.

Definition at line 1801 of file config_entries.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.config_entries.ConfigEntries.__init__ (   self,
HomeAssistant  hass,
ConfigType  hass_config 
)
Initialize the entry manager.

Definition at line 1807 of file config_entries.py.

Member Function Documentation

◆ _async_clean_up()

None homeassistant.config_entries.ConfigEntries._async_clean_up (   self,
ConfigEntry  entry 
)
private
Clean up after an entry.

Definition at line 1952 of file config_entries.py.

◆ _async_dispatch()

None homeassistant.config_entries.ConfigEntries._async_dispatch (   self,
ConfigEntryChange  change_type,
ConfigEntry   entry 
)
private
Dispatch a config entry change.

Definition at line 2253 of file config_entries.py.

◆ _async_forward_entry_setup()

bool homeassistant.config_entries.ConfigEntries._async_forward_entry_setup (   self,
ConfigEntry  entry,
Platform | str  domain,
bool  preload_platform 
)
private
Forward the setup of an entry to a different component.

Definition at line 2356 of file config_entries.py.

◆ _async_forward_entry_setups_locked()

None homeassistant.config_entries.ConfigEntries._async_forward_entry_setups_locked (   self,
ConfigEntry  entry,
Iterable[Platform | str]   platforms 
)
private

Definition at line 2299 of file config_entries.py.

◆ _async_remove()

tuple[bool, ConfigEntry] homeassistant.config_entries.ConfigEntries._async_remove (   self,
str  entry_id 
)
private
Remove and unload an entry.

Definition at line 1933 of file config_entries.py.

◆ _async_schedule_save()

None homeassistant.config_entries.ConfigEntries._async_schedule_save (   self)
private
Save the entity registry to a file.

Definition at line 2423 of file config_entries.py.

◆ _async_shutdown()

None homeassistant.config_entries.ConfigEntries._async_shutdown (   self,
Event  event 
)
private
Call when Home Assistant is stopping.

Definition at line 1976 of file config_entries.py.

◆ _data_to_save()

dict[str, list[dict[str, Any]]] homeassistant.config_entries.ConfigEntries._data_to_save (   self)
private
Return data to save.

Definition at line 2428 of file config_entries.py.

◆ async_add()

None homeassistant.config_entries.ConfigEntries.async_add (   self,
ConfigEntry  entry 
)
Add and setup an entry.

Definition at line 1906 of file config_entries.py.

◆ async_domains()

list[str] homeassistant.config_entries.ConfigEntries.async_domains (   self,
bool   include_ignore = False,
bool   include_disabled = False 
)
Return domains for which we have entries.

Definition at line 1818 of file config_entries.py.

◆ async_entries()

list[ConfigEntry] homeassistant.config_entries.ConfigEntries.async_entries (   self,
str | None   domain = None,
bool   include_ignore = True,
bool   include_disabled = True 
)
Return all entries or entries for a specific domain.

Definition at line 1867 of file config_entries.py.

◆ async_entry_for_domain_unique_id()

ConfigEntry | None homeassistant.config_entries.ConfigEntries.async_entry_for_domain_unique_id (   self,
str  domain,
str   unique_id 
)
Return entry for a domain with a matching unique id.

Definition at line 1900 of file config_entries.py.

◆ async_entry_ids()

list[str] homeassistant.config_entries.ConfigEntries.async_entry_ids (   self)
Return entry ids.

Definition at line 1847 of file config_entries.py.

◆ async_forward_entry_setup()

bool homeassistant.config_entries.ConfigEntries.async_forward_entry_setup (   self,
ConfigEntry  entry,
Platform | str   domain 
)
Forward the setup of an entry to a different component.

By default an entry is setup with the component it belongs to. If that
component also has related platforms, the component will have to
forward the entry to be setup by that component.

This method is deprecated and will stop working in Home Assistant 2025.6.

Instead, await async_forward_entry_setups as it can load
multiple platforms at once and is more efficient since it
does not require a separate import executor job for each platform.

Definition at line 2316 of file config_entries.py.

◆ async_forward_entry_setups()

None homeassistant.config_entries.ConfigEntries.async_forward_entry_setups (   self,
ConfigEntry  entry,
Iterable[Platform | str]   platforms 
)
Forward the setup of an entry to platforms.

This method should be awaited before async_setup_entry is finished
in each integration. This is to ensure that all platforms are loaded
before the entry is set up. This ensures that the config entry cannot
be unloaded before all platforms are loaded.

This method is more efficient than async_forward_entry_setup as
it can load multiple platforms at once and does not require a separate
import executor job for each platform.

Definition at line 2261 of file config_entries.py.

◆ async_forward_entry_unload()

bool homeassistant.config_entries.ConfigEntries.async_forward_entry_unload (   self,
ConfigEntry  entry,
Platform | str   domain 
)
Forward the unloading of an entry to a different component.

Its is preferred to call async_unload_platforms instead
of directly calling this method.

Definition at line 2406 of file config_entries.py.

◆ async_get_entry()

ConfigEntry | None homeassistant.config_entries.ConfigEntries.async_get_entry (   self,
str  entry_id 
)
Return entry with matching entry_id.

Definition at line 1832 of file config_entries.py.

◆ async_get_known_entry()

ConfigEntry homeassistant.config_entries.ConfigEntries.async_get_known_entry (   self,
str  entry_id 
)
Return entry with matching entry_id.

Raises UnknownEntry if entry is not found.

Definition at line 1837 of file config_entries.py.

◆ async_has_entries()

bool homeassistant.config_entries.ConfigEntries.async_has_entries (   self,
str  domain,
bool   include_ignore = True,
bool   include_disabled = True 
)
Return if there are entries for a domain.

Definition at line 1852 of file config_entries.py.

◆ async_initialize()

None homeassistant.config_entries.ConfigEntries.async_initialize (   self)
Initialize config entry config.

Definition at line 1982 of file config_entries.py.

◆ async_loaded_entries()

list[ConfigEntry] homeassistant.config_entries.ConfigEntries.async_loaded_entries (   self,
str  domain 
)
Return loaded entries for a specific domain.

This will exclude ignored or disabled config entruis.

Definition at line 1890 of file config_entries.py.

◆ async_reload()

bool homeassistant.config_entries.ConfigEntries.async_reload (   self,
str  entry_id 
)
Reload an entry.

When reloading from an integration is is preferable to
call async_schedule_reload instead of this method since
it will cancel setup retry before starting this method
in a task which eliminates a race condition where the
setup retry can fire during the reload.

If an entry was not loaded, will just load.

Definition at line 2084 of file config_entries.py.

◆ async_remove()

dict[str, Any] homeassistant.config_entries.ConfigEntries.async_remove (   self,
str  entry_id 
)
Remove, unload and clean up after an entry.

Definition at line 1919 of file config_entries.py.

◆ async_schedule_reload()

None homeassistant.config_entries.ConfigEntries.async_schedule_reload (   self,
str  entry_id 
)
Schedule a config entry to be reloaded.

Definition at line 2075 of file config_entries.py.

◆ async_set_disabled_by()

bool homeassistant.config_entries.ConfigEntries.async_set_disabled_by (   self,
str  entry_id,
ConfigEntryDisabler | None   disabled_by 
)
Disable an entry.

If disabled_by is changed, the config entry will be reloaded.

Definition at line 2118 of file config_entries.py.

◆ async_setup()

bool homeassistant.config_entries.ConfigEntries.async_setup (   self,
str  entry_id,
bool   _lock = True 
)
Set up a config entry.

Return True if entry has been successfully loaded.

Definition at line 2023 of file config_entries.py.

◆ async_unload()

bool homeassistant.config_entries.ConfigEntries.async_unload (   self,
str  entry_id,
bool   _lock = True 
)
Unload a config entry.

Definition at line 2057 of file config_entries.py.

◆ async_unload_platforms()

bool homeassistant.config_entries.ConfigEntries.async_unload_platforms (   self,
ConfigEntry  entry,
Iterable[Platform | str]   platforms 
)
Forward the unloading of an entry to platforms.

Definition at line 2386 of file config_entries.py.

◆ async_update_entry()

bool homeassistant.config_entries.ConfigEntries.async_update_entry (   self,
ConfigEntry  entry,
*Mapping[str, Any] | UndefinedType   data = UNDEFINED,
MappingProxyType[str, tuple[DiscoveryKey, ...]] | UndefinedType   discovery_keys = UNDEFINED,
int | UndefinedType   minor_version = UNDEFINED,
Mapping[str, Any] | UndefinedType   options = UNDEFINED,
bool | UndefinedType   pref_disable_new_entities = UNDEFINED,
bool | UndefinedType   pref_disable_polling = UNDEFINED,
str | UndefinedType   title = UNDEFINED,
str | None | UndefinedType   unique_id = UNDEFINED,
int | UndefinedType   version = UNDEFINED 
)
Update a config entry.

If the entry was changed, the update_listeners are
fired and this function returns True

If the entry was not changed, the update_listeners are
not fired and this function returns False

Definition at line 2153 of file config_entries.py.

◆ async_update_issues()

None homeassistant.config_entries.ConfigEntries.async_update_issues (   self)
Update unique id collision issues.

Definition at line 2453 of file config_entries.py.

◆ async_wait_component()

bool homeassistant.config_entries.ConfigEntries.async_wait_component (   self,
ConfigEntry  entry 
)
Wait for an entry's component to load and return if the entry is loaded.

This is primarily intended for existing config entries which are loaded at
startup, awaiting this function will block until the component and all its
config entries are loaded.
Config entries which are created after Home Assistant is started can't be waited
for, the function will just return if the config entry is loaded or not.

Definition at line 2435 of file config_entries.py.

Member Data Documentation

◆ _entries

homeassistant.config_entries.ConfigEntries._entries
private

Definition at line 1813 of file config_entries.py.

◆ _hass_config

homeassistant.config_entries.ConfigEntries._hass_config
private

Definition at line 1812 of file config_entries.py.

◆ _store

homeassistant.config_entries.ConfigEntries._store
private

Definition at line 1814 of file config_entries.py.

◆ flow

homeassistant.config_entries.ConfigEntries.flow

Definition at line 1810 of file config_entries.py.

◆ hass

homeassistant.config_entries.ConfigEntries.hass

Definition at line 1809 of file config_entries.py.

◆ options

homeassistant.config_entries.ConfigEntries.options

Definition at line 1811 of file config_entries.py.


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