Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The lg_netcast component."""
2 
3 from typing import Final
4 
5 from homeassistant.config_entries import ConfigEntry
6 from homeassistant.const import Platform
7 from homeassistant.core import HomeAssistant
8 from homeassistant.helpers import config_validation as cv
9 
10 from .const import DOMAIN
11 
12 PLATFORMS: Final[list[Platform]] = [Platform.MEDIA_PLAYER]
13 
14 CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
15 
16 
17 async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
18  """Set up a config entry."""
19  hass.data.setdefault(DOMAIN, {})
20 
21  await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
22 
23  return True
24 
25 
26 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
27  """Unload a config entry."""
28  unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
29 
30  if unload_ok:
31  del hass.data[DOMAIN][entry.entry_id]
32 
33  return unload_ok
bool async_setup_entry(HomeAssistant hass, ConfigEntry config_entry)
Definition: __init__.py:17
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:26