Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The Elv integration."""
2 
3 import voluptuous as vol
4 
5 from homeassistant.const import CONF_DEVICE, Platform
6 from homeassistant.core import HomeAssistant
7 from homeassistant.helpers import discovery
9 from homeassistant.helpers.typing import ConfigType
10 
11 DOMAIN = "elv"
12 
13 DEFAULT_DEVICE = "/dev/ttyUSB0"
14 
15 ELV_PLATFORMS = [Platform.SWITCH]
16 
17 CONFIG_SCHEMA = vol.Schema(
18  {
19  DOMAIN: vol.Schema(
20  {vol.Optional(CONF_DEVICE, default=DEFAULT_DEVICE): cv.string}
21  )
22  },
23  extra=vol.ALLOW_EXTRA,
24 )
25 
26 
27 def setup(hass: HomeAssistant, config: ConfigType) -> bool:
28  """Set up the PCA switch platform."""
29 
30  for platform in ELV_PLATFORMS:
31  discovery.load_platform(
32  hass, platform, DOMAIN, {"device": config[DOMAIN][CONF_DEVICE]}, config
33  )
34 
35  return True
bool setup(HomeAssistant hass, ConfigType config)
Definition: __init__.py:27