homeassistant.config_entries

Manage config entries in Home Assistant.

class homeassistant.config_entries.ConfigEntries(hass: homeassistant.core.HomeAssistant, hass_config: dict)[source]

Manage the configuration entries.

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

async async_add(entry: homeassistant.config_entries.ConfigEntry) → None[source]

Add and setup an entry.

async_domains() → List[str][source]

Return domains for which we have entries.

async_entries(domain: Optional[str] = None) → List[homeassistant.config_entries.ConfigEntry][source]

Return all entries or entries for a specific domain.

async async_forward_entry_setup(entry: homeassistant.config_entries.ConfigEntry, domain: str) → bool[source]

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.

You don’t want to await this coroutine if it is called as part of the setup of a component, because it can cause a deadlock.

async async_forward_entry_unload(entry: homeassistant.config_entries.ConfigEntry, domain: str) → bool[source]

Forward the unloading of an entry to a different component.

async_get_entry(entry_id: str) → Optional[homeassistant.config_entries.ConfigEntry][source]

Return entry with matching entry_id.

async async_initialize() → None[source]

Initialize config entry config.

async async_reload(entry_id: str) → bool[source]

Reload an entry.

If an entry was not loaded, will just load.

async async_remove(entry_id: str) → Dict[str, Any][source]

Remove an entry.

async async_setup(entry_id: str) → bool[source]

Set up a config entry.

Return True if entry has been successfully loaded.

async async_unload(entry_id: str) → bool[source]

Unload a config entry.

async_update_entry(entry: homeassistant.config_entries.ConfigEntry, *, unique_id: Union[str, dict, None] = {}, title: Union[str, dict] = {}, data: dict = {}, options: dict = {}, system_options: dict = {}) → None[source]

Update a config entry.

class homeassistant.config_entries.ConfigEntriesFlowManager(hass: homeassistant.core.HomeAssistant, config_entries: homeassistant.config_entries.ConfigEntries, hass_config: dict)[source]

Manage all the config entry flows that are in progress.

async async_create_flow(handler_key: Any, *, context: Optional[Dict] = None, data: Any = None) → homeassistant.config_entries.ConfigFlow[source]

Create a flow for specified handler.

Handler key is the domain of the component that we want to set up.

async async_finish_flow(flow: homeassistant.data_entry_flow.FlowHandler, result: Dict[str, Any]) → Dict[str, Any][source]

Finish a config flow and add an entry.

async async_post_init(flow: homeassistant.data_entry_flow.FlowHandler, result: dict) → None[source]

After a flow is initialised trigger new flow notifications.

class homeassistant.config_entries.ConfigEntry(version: int, domain: str, title: str, data: dict, source: str, connection_class: str, system_options: dict, options: Optional[dict] = None, unique_id: Optional[str] = None, entry_id: Optional[str] = None, state: str = 'not_loaded')[source]

Hold a configuration entry.

add_update_listener(listener: Callable) → Callable[source]

Listen for when entry is updated.

Listener: Callback function(hass, entry)

Returns function to unlisten.

as_dict() → Dict[str, Any][source]

Return dictionary version of this entry.

async async_migrate(hass: homeassistant.core.HomeAssistant) → bool[source]

Migrate an entry.

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

async async_remove(hass: homeassistant.core.HomeAssistant) → None[source]

Invoke remove callback on component.

async async_setup(hass: homeassistant.core.HomeAssistant, *, integration: Optional[homeassistant.loader.Integration] = None, tries: int = 0) → None[source]

Set up an entry.

async async_unload(hass: homeassistant.core.HomeAssistant, *, integration: Optional[homeassistant.loader.Integration] = None) → bool[source]

Unload an entry.

Returns if unload is possible and was successful.

exception homeassistant.config_entries.ConfigError[source]

Error while configuring an account.

class homeassistant.config_entries.ConfigFlow[source]

Base class for config flows with some helpers.

static async_get_options_flow(config_entry: homeassistant.config_entries.ConfigEntry) → homeassistant.config_entries.OptionsFlow[source]

Get the options flow for this handler.

async async_set_unique_id(unique_id: str, *, raise_on_progress: bool = True) → Optional[homeassistant.config_entries.ConfigEntry][source]

Set a unique ID for the config flow.

Returns optionally existing config entry with same ID.

async async_step_ignore(user_input: Dict[str, Any]) → Dict[str, Any][source]

Ignore this config flow.

async async_step_unignore(user_input: Dict[str, Any]) → Dict[str, Any][source]

Rediscover a config entry by it’s unique_id.

property unique_id

Return unique ID if available.

class homeassistant.config_entries.EntityRegistryDisabledHandler(hass: homeassistant.core.HomeAssistant)[source]

Handler to handle when entities related to config entries updating disabled_by.

async_setup() → None[source]

Set up the disable handler.

exception homeassistant.config_entries.OperationNotAllowed[source]

Raised when a config entry operation is not allowed.

class homeassistant.config_entries.OptionsFlow[source]

Base class for config option flows.

class homeassistant.config_entries.OptionsFlowManager(hass: homeassistant.core.HomeAssistant)[source]

Flow to set options for a configuration entry.

async async_create_flow(handler_key: Any, *, context: Optional[Dict[str, Any]] = None, data: Optional[Dict[str, Any]] = None) → homeassistant.config_entries.OptionsFlow[source]

Create an options flow for a config entry.

Entry_id and flow.handler is the same thing to map entry with flow.

async async_finish_flow(flow: homeassistant.data_entry_flow.FlowHandler, result: Dict[str, Any]) → Dict[str, Any][source]

Finish an options flow and update options for configuration entry.

Flow.handler and entry_id is the same thing to map flow with entry.

class homeassistant.config_entries.SystemOptions(disable_new_entities: bool = False)[source]

Config entry system options.

as_dict() → Dict[str, Any][source]

Return dictionary version of this config entries system options.

update(*, disable_new_entities: bool) → None[source]

Update properties.

exception homeassistant.config_entries.UnknownEntry[source]

Unknown entry specified.

async homeassistant.config_entries.support_entry_unload(hass: homeassistant.core.HomeAssistant, domain: str) → bool[source]

Test if a domain supports entry unloading.