2019-06-19 22:58:39 +00:00
|
|
|
"""The Elv integration."""
|
2019-09-24 11:10:03 +00:00
|
|
|
import voluptuous as vol
|
|
|
|
|
|
|
|
from homeassistant.const import CONF_DEVICE
|
2019-12-09 13:10:04 +00:00
|
|
|
from homeassistant.helpers import discovery
|
2019-09-24 11:10:03 +00:00
|
|
|
import homeassistant.helpers.config_validation as cv
|
|
|
|
|
|
|
|
DOMAIN = "elv"
|
|
|
|
|
|
|
|
DEFAULT_DEVICE = "/dev/ttyUSB0"
|
|
|
|
|
|
|
|
ELV_PLATFORMS = ["switch"]
|
|
|
|
|
|
|
|
CONFIG_SCHEMA = vol.Schema(
|
|
|
|
{
|
|
|
|
DOMAIN: vol.Schema(
|
|
|
|
{vol.Optional(CONF_DEVICE, default=DEFAULT_DEVICE): cv.string}
|
|
|
|
)
|
|
|
|
},
|
|
|
|
extra=vol.ALLOW_EXTRA,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def setup(hass, config):
|
|
|
|
"""Set up the PCA switch platform."""
|
|
|
|
|
|
|
|
for platform in ELV_PLATFORMS:
|
|
|
|
discovery.load_platform(
|
|
|
|
hass, platform, DOMAIN, {"device": config[DOMAIN][CONF_DEVICE]}, config
|
|
|
|
)
|
|
|
|
|
|
|
|
return True
|