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