Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """Calculates mold growth indication from temperature and humidity."""
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 Mold indicator from a config entry."""
12 
13  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
14  entry.async_on_unload(entry.add_update_listener(update_listener))
15 
16  return True
17 
18 
19 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
20  """Unload Mold indicator config entry."""
21  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
22 
23 
24 async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
25  """Handle options update."""
26  await hass.config_entries.async_reload(entry.entry_id)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:19
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:10
None update_listener(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:24