Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The simplepush component."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 from homeassistant.const import Platform
5 from homeassistant.core import HomeAssistant
6 from homeassistant.helpers import config_validation as cv, discovery
7 from homeassistant.helpers.typing import ConfigType
8 
9 from .const import DATA_HASS_CONFIG, DOMAIN
10 
11 PLATFORMS = [Platform.NOTIFY]
12 
13 CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
14 
15 
16 async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
17  """Set up the simplepush component."""
18 
19  hass.data[DATA_HASS_CONFIG] = config
20  return True
21 
22 
23 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
24  """Set up simplepush from a config entry."""
25 
26  hass.async_create_task(
27  discovery.async_load_platform(
28  hass,
29  Platform.NOTIFY,
30  DOMAIN,
31  dict(entry.data),
32  hass.data[DATA_HASS_CONFIG],
33  )
34  )
35 
36  return True
37 
38 
39 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
40  """Unload a config entry."""
41  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:39
bool async_setup(HomeAssistant hass, ConfigType config)
Definition: __init__.py:16
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:23