Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The google_cloud component."""
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 PLATFORMS = [Platform.STT, Platform.TTS]
10 
11 
12 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
13  """Set up a config entry."""
14  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
15  entry.async_on_unload(entry.add_update_listener(async_update_options))
16  return True
17 
18 
19 async def async_update_options(hass: HomeAssistant, entry: ConfigEntry) -> None:
20  """Handle options update."""
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:12
None async_update_options(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:19