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