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