-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
38 lines (29 loc) · 909 Bytes
/
__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
import logging
import voluptuous as vol
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.discovery import async_load_platform
_LOGGER = logging.getLogger(__name__)
DOMAIN = "wealden_bin_collection"
PLATFORMS = ["sensor"]
CONF_UPRN = "uprn"
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_UPRN): cv.string,
}
)
},
extra=vol.ALLOW_EXTRA,
)
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Wealden Bin Collection component."""
conf = config.get(DOMAIN)
if conf is None:
return True
uprn = conf.get(CONF_UPRN)
hass.data[DOMAIN] = {CONF_UPRN: uprn}
for platform in PLATFORMS:
hass.async_create_task(async_load_platform(hass, platform, DOMAIN, {}, config))
return True