Home Assistant Unofficial Reference 2024.12.1
homeassistant.config_entries.ConfigEntry Class Reference
Inheritance diagram for homeassistant.config_entries.ConfigEntry:
[legend]
Collaboration diagram for homeassistant.config_entries.ConfigEntry:
[legend]

Public Member Functions

None __init__ (self, *datetime|None created_at=None, Mapping[str, Any] data, ConfigEntryDisabler|None disabled_by=None, MappingProxyType[str, tuple[DiscoveryKey,...]] discovery_keys, str domain, str|None entry_id=None, int minor_version, datetime|None modified_at=None, Mapping[str, Any]|None options, bool|None pref_disable_new_entities=None, bool|None pref_disable_polling=None, str source, ConfigEntryState state=ConfigEntryState.NOT_LOADED, str title, str|None unique_id, int version)
 
str __repr__ (self)
 
None __setattr__ (self, str key, Any value)
 
CALLBACK_TYPE add_update_listener (self, UpdateListenerType listener)
 
dict[str, Any] as_dict (self)
 
json_fragment as_json_fragment (self)
 
json_fragment as_storage_fragment (self)
 
None async_cancel_retry_setup (self)
 
Generator[ConfigFlowResultasync_get_active_flows (self, HomeAssistant hass, set[str] sources)
 
bool async_migrate (self, HomeAssistant hass)
 
None async_on_unload (self, Callable[[], Coroutine[Any, Any, None]|None] func)
 
None async_remove (self, HomeAssistant hass)
 
None async_setup (self, HomeAssistant hass, *loader.Integration|None integration=None)
 
None async_setup_locked (self, HomeAssistant hass, loader.Integration|None integration=None)
 
None async_shutdown (self)
 
None async_start_reauth (self, HomeAssistant hass, ConfigFlowContext|None context=None, dict[str, Any]|None data=None)
 
bool async_unload (self, HomeAssistant hass, *loader.Integration|None integration=None)
 
None clear_state_cache (self)
 
None clear_storage_cache (self)
 
bool supports_options (self)
 
bool supports_reconfigure (self)
 

Public Attributes

 domain
 
 minor_version
 
 source
 
 state
 
 supports_remove_device
 
 supports_unload
 
 version
 

Static Public Attributes

 default
 

Private Member Functions

None __async_setup_with_context (self, HomeAssistant hass, loader.Integration|None integration)
 
None _async_init_reauth (self, HomeAssistant hass, ConfigFlowContext|None context=None, dict[str, Any]|None data=None)
 
None _async_process_on_unload (self, HomeAssistant hass)
 
None _async_set_state (self, HomeAssistant hass, ConfigEntryState state, str|None reason, str|None error_reason_translation_key=None, dict[str, str]|None error_reason_translation_placeholders=None)
 
None _async_setup_again (self, HomeAssistant hass, *Any _)
 
asyncio.Task[_R] _R (self, HomeAssistant hass, Coroutine[Any, Any, _R] target, str name, bool eager_start=True)
 
asyncio.Task[_R] _R (self, HomeAssistant hass, Coroutine[Any, Any, _R] target, str|None name=None, bool eager_start=True)
 

Private Attributes

 _async_cancel_retry_setup
 
 _integration_for_domain
 
 _on_unload
 
 _tries
 

Detailed Description

Hold a configuration entry.

Definition at line 316 of file config_entries.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.config_entries.ConfigEntry.__init__ (   self,
*datetime | None   created_at = None,
Mapping[str, Any]  data,
ConfigEntryDisabler | None   disabled_by = None,
MappingProxyType[str, tuple[DiscoveryKey, ...]]  discovery_keys,
str  domain,
str | None   entry_id = None,
int  minor_version,
datetime | None   modified_at = None,
Mapping[str, Any] | None  options,
bool | None   pref_disable_new_entities = None,
bool | None   pref_disable_polling = None,
str  source,
ConfigEntryState   state = ConfigEntryState.NOT_LOADED,
str  title,
str | None  unique_id,
int  version 
)
Initialize a config entry.

Definition at line 353 of file config_entries.py.

Member Function Documentation

◆ __async_setup_with_context()

None homeassistant.config_entries.ConfigEntry.__async_setup_with_context (   self,
HomeAssistant  hass,
loader.Integration | None  integration 
)
private
Set up an entry, with current_entry set.

Definition at line 555 of file config_entries.py.

◆ __repr__()

str homeassistant.config_entries.ConfigEntry.__repr__ (   self)
Representation of ConfigEntry.

Definition at line 458 of file config_entries.py.

◆ __setattr__()

None homeassistant.config_entries.ConfigEntry.__setattr__ (   self,
str  key,
Any  value 
)
Set an attribute.

Definition at line 465 of file config_entries.py.

◆ _async_init_reauth()

None homeassistant.config_entries.ConfigEntry._async_init_reauth (   self,
HomeAssistant  hass,
ConfigFlowContext | None   context = None,
dict[str, Any] | None   data = None 
)
private
Start a reauth flow.

Definition at line 1080 of file config_entries.py.

◆ _async_process_on_unload()

None homeassistant.config_entries.ConfigEntry._async_process_on_unload (   self,
HomeAssistant  hass 
)
private
Process the on_unload callbacks and wait for pending tasks.

Definition at line 1035 of file config_entries.py.

◆ _async_set_state()

None homeassistant.config_entries.ConfigEntry._async_set_state (   self,
HomeAssistant  hass,
ConfigEntryState  state,
str | None  reason,
str | None   error_reason_translation_key = None,
dict[str, str] | None   error_reason_translation_placeholders = None 
)
private
Set the state of the config entry.

Definition at line 920 of file config_entries.py.

◆ _async_setup_again()

None homeassistant.config_entries.ConfigEntry._async_setup_again (   self,
HomeAssistant  hass,
*Any  _ 
)
private
Schedule setup again.

This method is a callback to ensure that _async_cancel_retry_setup
is unset as soon as its callback is called.

Definition at line 756 of file config_entries.py.

◆ _R() [1/2]

asyncio.Task[_R] homeassistant.config_entries.ConfigEntry._R (   self,
HomeAssistant  hass,
Coroutine[Any, Any, _R]  target,
str  name,
bool   eager_start = True 
)
private
Create a background task tied to the config entry lifecycle.

Background tasks are automatically canceled when config entry is unloaded.

A background task is different from a normal task:

  - Will not block startup
  - Will be automatically cancelled on shutdown
  - Calls to async_block_till_done will not wait for completion

This method must be run in the event loop.

Definition at line 1161 of file config_entries.py.

◆ _R() [2/2]

asyncio.Task[_R] homeassistant.config_entries.ConfigEntry._R (   self,
HomeAssistant  hass,
Coroutine[Any, Any, _R]  target,
str | None   name = None,
bool   eager_start = True 
)
private
Create a task from within the event loop.

This method must be run in the event loop.

target: target to call.

Definition at line 1137 of file config_entries.py.

◆ add_update_listener()

CALLBACK_TYPE homeassistant.config_entries.ConfigEntry.add_update_listener (   self,
UpdateListenerType  listener 
)
Listen for when entry is updated.

Returns function to unlisten.

Definition at line 998 of file config_entries.py.

◆ as_dict()

dict[str, Any] homeassistant.config_entries.ConfigEntry.as_dict (   self)
Return dictionary version of this entry.

Definition at line 1006 of file config_entries.py.

◆ as_json_fragment()

json_fragment homeassistant.config_entries.ConfigEntry.as_json_fragment (   self)
Return JSON fragment of a config entry that is used for the API.

Definition at line 507 of file config_entries.py.

◆ as_storage_fragment()

json_fragment homeassistant.config_entries.ConfigEntry.as_storage_fragment (   self)
Return a storage fragment for this entry.

Definition at line 535 of file config_entries.py.

◆ async_cancel_retry_setup()

None homeassistant.config_entries.ConfigEntry.async_cancel_retry_setup (   self)
Cancel retry setup.

Definition at line 796 of file config_entries.py.

◆ async_get_active_flows()

Generator[ConfigFlowResult] homeassistant.config_entries.ConfigEntry.async_get_active_flows (   self,
HomeAssistant  hass,
set[str]   sources 
)
Get any active flows of certain sources for this entry.

Definition at line 1122 of file config_entries.py.

◆ async_migrate()

bool homeassistant.config_entries.ConfigEntry.async_migrate (   self,
HomeAssistant  hass 
)
Migrate an entry.

Returns True if config entry is up-to-date or has been migrated.

Definition at line 948 of file config_entries.py.

◆ async_on_unload()

None homeassistant.config_entries.ConfigEntry.async_on_unload (   self,
Callable[[], Coroutine[Any, Any, None] | None]   func 
)
Add a function to call when config entry is unloaded.

Definition at line 1027 of file config_entries.py.

◆ async_remove()

None homeassistant.config_entries.ConfigEntry.async_remove (   self,
HomeAssistant  hass 
)
Invoke remove callback on component.

Definition at line 878 of file config_entries.py.

◆ async_setup()

None homeassistant.config_entries.ConfigEntry.async_setup (   self,
HomeAssistant  hass,
*loader.Integration | None   integration = None 
)
Set up an entry.

Definition at line 539 of file config_entries.py.

◆ async_setup_locked()

None homeassistant.config_entries.ConfigEntry.async_setup_locked (   self,
HomeAssistant  hass,
loader.Integration | None   integration = None 
)
Set up while holding the setup lock.

Definition at line 772 of file config_entries.py.

◆ async_shutdown()

None homeassistant.config_entries.ConfigEntry.async_shutdown (   self)
Call when Home Assistant is stopping.

Definition at line 791 of file config_entries.py.

◆ async_start_reauth()

None homeassistant.config_entries.ConfigEntry.async_start_reauth (   self,
HomeAssistant  hass,
ConfigFlowContext | None   context = None,
dict[str, Any] | None   data = None 
)
Start a reauth flow.

Definition at line 1062 of file config_entries.py.

◆ async_unload()

bool homeassistant.config_entries.ConfigEntry.async_unload (   self,
HomeAssistant  hass,
*loader.Integration | None   integration = None 
)
Unload an entry.

Returns if unload is possible and was successful.

Definition at line 802 of file config_entries.py.

◆ clear_state_cache()

None homeassistant.config_entries.ConfigEntry.clear_state_cache (   self)
Clear cached properties that are included in as_json_fragment.

Definition at line 502 of file config_entries.py.

◆ clear_storage_cache()

None homeassistant.config_entries.ConfigEntry.clear_storage_cache (   self)
Clear cached properties that are included in as_storage_fragment.

Definition at line 530 of file config_entries.py.

◆ supports_options()

bool homeassistant.config_entries.ConfigEntry.supports_options (   self)
Return if entry supports config options.

Definition at line 479 of file config_entries.py.

◆ supports_reconfigure()

bool homeassistant.config_entries.ConfigEntry.supports_reconfigure (   self)
Return if entry supports reconfigure step.

Definition at line 489 of file config_entries.py.

Member Data Documentation

◆ _async_cancel_retry_setup

homeassistant.config_entries.ConfigEntry._async_cancel_retry_setup
private

Definition at line 705 of file config_entries.py.

◆ _integration_for_domain

homeassistant.config_entries.ConfigEntry._integration_for_domain
private

Definition at line 563 of file config_entries.py.

◆ _on_unload

homeassistant.config_entries.ConfigEntry._on_unload
private

Definition at line 1032 of file config_entries.py.

◆ _tries

homeassistant.config_entries.ConfigEntry._tries
private

Definition at line 930 of file config_entries.py.

◆ default

homeassistant.config_entries.ConfigEntry.default
static

Definition at line 1189 of file config_entries.py.

◆ domain

homeassistant.config_entries.ConfigEntry.domain

Definition at line 566 of file config_entries.py.

◆ minor_version

homeassistant.config_entries.ConfigEntry.minor_version

Definition at line 965 of file config_entries.py.

◆ source

homeassistant.config_entries.ConfigEntry.source

Definition at line 546 of file config_entries.py.

◆ state

homeassistant.config_entries.ConfigEntry.state

Definition at line 813 of file config_entries.py.

◆ supports_remove_device

homeassistant.config_entries.ConfigEntry.supports_remove_device

Definition at line 587 of file config_entries.py.

◆ supports_unload

homeassistant.config_entries.ConfigEntry.supports_unload

Definition at line 585 of file config_entries.py.

◆ version

homeassistant.config_entries.ConfigEntry.version

Definition at line 964 of file config_entries.py.


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