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(include_ignore: bool = False, include_disabled: bool = False) → list[str][source]

Return domains for which we have entries.

async_entries(domain: str | None = None) → list[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) → ConfigEntry | None[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_set_disabled_by(entry_id: str, disabled_by: str | None) → bool[source]

Disable an entry.

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

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

Set up a config entry.

Return True if entry has been successfully loaded.

async_setup_platforms(entry: ConfigEntry, platforms: Iterable[str]) → None[source]

Forward the setup of an entry to platforms.

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

Unload a config entry.

async async_unload_platforms(entry: ConfigEntry, platforms: Iterable[str]) → bool[source]

Forward the unloading of an entry to platforms.

async_update_entry(entry: ConfigEntry, *, unique_id: str | None | UndefinedType = <UndefinedType._singleton: 0>, title: str | UndefinedType = <UndefinedType._singleton: 0>, data: dict | UndefinedType = <UndefinedType._singleton: 0>, options: Mapping[str, Any] | UndefinedType = <UndefinedType._singleton: 0>, pref_disable_new_entities: bool | UndefinedType = <UndefinedType._singleton: 0>, pref_disable_polling: bool | UndefinedType = <UndefinedType._singleton: 0>) → bool[source]

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

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: dict | None = None, data: Any = None) → 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: homeassistant.data_entry_flow.FlowResult) → homeassistant.data_entry_flow.FlowResult[source]

Finish a config flow and add an entry.

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

After a flow is initialised trigger new flow notifications.

class homeassistant.config_entries.ConfigEntry(version: int, domain: str, title: str, data: Mapping[str, Any], source: str, pref_disable_new_entities: bool | None = None, pref_disable_polling: bool | None = None, options: Mapping[str, Any] | None = None, unique_id: str | None = None, entry_id: str | None = None, state: ConfigEntryState = <ConfigEntryState.NOT_LOADED: 'not_loaded'>, disabled_by: str | None = None)[source]

Hold a configuration entry.

add_update_listener(listener: Callable[[homeassistant.core.HomeAssistant, ConfigEntry], Any]) → Callable[[], None][source]

Listen for when entry is updated.

Returns function to unlisten.

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

Return dictionary version of this entry.

async_cancel_retry_setup() → None[source]

Cancel retry setup.

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_on_unload(func: Callable[[], None]) → None[source]

Add a function to call when config entry is unloaded.

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

Invoke remove callback on component.

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

Set up an entry.

async async_shutdown() → None[source]

Call when Home Assistant is stopping.

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

Start a reauth flow.

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

Unload an entry.

Returns if unload is possible and was successful.

class homeassistant.config_entries.ConfigEntryState[source]

Config entry state.

property recoverable

Get if the state is recoverable.

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.

async_abort(*, reason: str, description_placeholders: dict | None = None) → data_entry_flow.FlowResult[source]

Abort the config flow.

async_create_entry(*, title: str, data: Mapping[str, Any], description: str | None = None, description_placeholders: dict | None = None, options: Mapping[str, Any] | None = None) → data_entry_flow.FlowResult[source]

Finish config flow and create a config entry.

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 | None = None, *, raise_on_progress: bool = True) → ConfigEntry | None[source]

Set a unique ID for the config flow.

Returns optionally existing config entry with same ID.

async async_step_dhcp(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by DHCP discovery.

async async_step_discovery(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by discovery.

async async_step_hassio(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by HASS IO discovery.

async async_step_homekit(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by Homekit discovery.

async async_step_ignore(user_input: dict[str, Any]) → data_entry_flow.FlowResult[source]

Ignore this config flow.

async async_step_mqtt(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by MQTT discovery.

async async_step_ssdp(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by SSDP discovery.

async async_step_unignore(user_input: dict[str, Any]) → data_entry_flow.FlowResult[source]

Rediscover a config entry by it’s unique_id.

async async_step_user(user_input: dict[str, Any] | None = None) → data_entry_flow.FlowResult[source]

Handle a flow initiated by the user.

async async_step_zeroconf(discovery_info: Dict[str, Any]) → homeassistant.data_entry_flow.FlowResult[source]

Handle a flow initialized by Zeroconf discovery.

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: dict[str, Any] | None = None, data: dict[str, Any] | None = None) → 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: homeassistant.data_entry_flow.FlowResult) → homeassistant.data_entry_flow.FlowResult[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.

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.