-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path__init__.py
39 lines (24 loc) · 1.07 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""The infinitecampus integration."""
from __future__ import annotations
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from .const import DOMAIN, HA_SENSOR
from .infinitehub import InfiniteHub
_LOGGER = logging.getLogger(__name__)
def setup(hass, config):
"""Set up init."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up infinitecampus from a config entry."""
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = InfiniteHub(hass)
# _LOGGER.warning("-------SETTING UP PLATFORMS--------")
await hass.config_entries.async_forward_entry_setups(entry, HA_SENSOR)
# _LOGGER.warning("-------COMPLETED SETTING UP PLATFORMS---------")
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, HA_SENSOR):
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok