forked from dext0r/yandex_smart_home
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
42 lines (31 loc) · 1.17 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
40
41
42
"""Support for Actions on Yandex Smart Home."""
import logging
from typing import Dict, Any
import voluptuous as vol
from homeassistant.core import HomeAssistant
from homeassistant.const import CONF_NAME
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import entityfilter
from .const import (
DOMAIN, CONF_ENTITY_CONFIG, CONF_FILTER, CONF_ROOM
)
from .http import async_register_http
_LOGGER = logging.getLogger(__name__)
ENTITY_SCHEMA = vol.Schema({
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_ROOM): cv.string,
})
YANDEX_SMART_HOME_SCHEMA = vol.All(
vol.Schema({
vol.Optional(CONF_FILTER, default={}): entityfilter.FILTER_SCHEMA,
vol.Optional(CONF_ENTITY_CONFIG, default={}): {cv.entity_id:
ENTITY_SCHEMA},
}, extra=vol.PREVENT_EXTRA))
CONFIG_SCHEMA = vol.Schema({
DOMAIN: YANDEX_SMART_HOME_SCHEMA
}, extra=vol.ALLOW_EXTRA)
async def async_setup(hass: HomeAssistant, yaml_config: Dict[str, Any]):
"""Activate Yandex Smart Home component."""
config = yaml_config.get(DOMAIN, {})
async_register_http(hass, config)
return True