Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The random component."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 from homeassistant.core import HomeAssistant
5 
6 
7 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
8  """Set up a config entry."""
9  await hass.config_entries.async_forward_entry_setups(
10  entry, (entry.options["entity_type"],)
11  )
12  entry.async_on_unload(entry.add_update_listener(config_entry_update_listener))
13  return True
14 
15 
16 async def config_entry_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
17  """Update listener, called when the config entry options are changed."""
18  await hass.config_entries.async_reload(entry.entry_id)
19 
20 
21 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
22  """Unload a config entry."""
23  return await hass.config_entries.async_unload_platforms(
24  entry, (entry.options["entity_type"],)
25  )
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:21
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:7
None config_entry_update_listener(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:16