1 """Support for EufyHome devices."""
4 import voluptuous
as vol
23 DEVICE_SCHEMA = vol.Schema(
25 vol.Required(CONF_ADDRESS): cv.string,
26 vol.Required(CONF_ACCESS_TOKEN): cv.string,
27 vol.Required(CONF_TYPE): cv.string,
28 vol.Optional(CONF_NAME): cv.string,
32 CONFIG_SCHEMA = vol.Schema(
36 vol.Optional(CONF_DEVICES, default=[]): vol.All(
37 cv.ensure_list, [DEVICE_SCHEMA]
39 vol.Inclusive(CONF_USERNAME,
"authentication"): cv.string,
40 vol.Inclusive(CONF_PASSWORD,
"authentication"): cv.string,
44 extra=vol.ALLOW_EXTRA,
48 "T1011": Platform.LIGHT,
49 "T1012": Platform.LIGHT,
50 "T1013": Platform.LIGHT,
51 "T1201": Platform.SWITCH,
52 "T1202": Platform.SWITCH,
53 "T1203": Platform.SWITCH,
54 "T1211": Platform.SWITCH,
58 def setup(hass: HomeAssistant, config: ConfigType) -> bool:
59 """Set up EufyHome devices."""
61 if CONF_USERNAME
in config[DOMAIN]
and CONF_PASSWORD
in config[DOMAIN]:
62 data = lakeside.get_devices(
63 config[DOMAIN][CONF_USERNAME], config[DOMAIN][CONF_PASSWORD]
67 if kind
not in PLATFORMS:
69 discovery.load_platform(hass, PLATFORMS[kind], DOMAIN, device, config)
71 for device_info
in config[DOMAIN][CONF_DEVICES]:
72 kind = device_info[
"type"]
73 if kind
not in PLATFORMS:
76 device[
"address"] = device_info[
"address"]
77 device[
"code"] = device_info[
"access_token"]
78 device[
"type"] = device_info[
"type"]
79 device[
"name"] = device_info[
"name"]
80 discovery.load_platform(hass, PLATFORMS[kind], DOMAIN, device, config)
bool setup(HomeAssistant hass, ConfigType config)