epenet 250379e181
Add setup type hints (init) (#64351)
* Add setup type hints to acmeda

* Add setup type hints to xiaomi_aqara

* Add setup type hints to motion_blinds

* Add setup type hints to xiaomi_miio

* Add setup type hints to diagnostics

* Add setup type hints to zha

* Add setup type hints to firmata

* Add setup type hints to denonavr

* Add setup type hints to rfxtrx

* Add setup type hints to hue

* Cleanup denonavr

* Add return types to xiaomi_miio

* Fix return type

Co-authored-by: epenet <epenet@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-01-19 18:00:34 +01:00

44 lines
1.1 KiB
Python

"""The Rollease Acmeda Automate integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from .const import DOMAIN
from .hub import PulseHub
CONF_HUBS = "hubs"
PLATFORMS = [Platform.COVER, Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Set up Rollease Acmeda Automate hub from a config entry."""
hub = PulseHub(hass, config_entry)
if not await hub.async_setup():
return False
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = hub
hass.config_entries.async_setup_platforms(config_entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Unload a config entry."""
hub = hass.data[DOMAIN][config_entry.entry_id]
unload_ok = await hass.config_entries.async_unload_platforms(
config_entry, PLATFORMS
)
if not await hub.async_reset():
return False
if unload_ok:
hass.data[DOMAIN].pop(config_entry.entry_id)
return unload_ok