1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00
ha-core/homeassistant/components/simplepush/__init__.py
Rami Mosleh d1708861db
Add config flow for simplepush (#73471)
* Add config flow for `simplepush`

* fix warning message

* fix typos

* Add importing yaml config

* patch integration setup

* Add check for errrors raised by the library

* fix coverage

* Adjust comment and logging message

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-06-24 08:39:48 +02:00

40 lines
1.1 KiB
Python

"""The simplepush component."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery
from homeassistant.helpers.typing import ConfigType
from .const import DATA_HASS_CONFIG, DOMAIN
PLATFORMS = [Platform.NOTIFY]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the simplepush component."""
hass.data[DATA_HASS_CONFIG] = config
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up simplepush from a config entry."""
hass.async_create_task(
discovery.async_load_platform(
hass,
Platform.NOTIFY,
DOMAIN,
dict(entry.data),
hass.data[DATA_HASS_CONFIG],
)
)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)