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