Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """Support for Enigma2 devices."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 from homeassistant.const import Platform
5 from homeassistant.core import HomeAssistant
6 
7 from .coordinator import Enigma2UpdateCoordinator
8 
9 type Enigma2ConfigEntry = ConfigEntry[Enigma2UpdateCoordinator]
10 
11 PLATFORMS = [Platform.MEDIA_PLAYER]
12 
13 
14 async def async_setup_entry(hass: HomeAssistant, entry: Enigma2ConfigEntry) -> bool:
15  """Set up Enigma2 from a config entry."""
16 
17  coordinator = Enigma2UpdateCoordinator(hass, entry)
18  await coordinator.async_config_entry_first_refresh()
19  entry.runtime_data = coordinator
20 
21  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
22  return True
23 
24 
25 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
26  """Unload a config entry."""
27  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:25
bool async_setup_entry(HomeAssistant hass, Enigma2ConfigEntry entry)
Definition: __init__.py:14