Add support for VeSync Fans (#36132)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Angelo GaglianoandJ. Nick Koston authored and GitHub committed 2020-09-03 21:05:37 -05:00
1 parent 48cfbf8662
commit eb7742ea7c
8 files changed
+181 -25

No files matched your search

+7 -6
View File
@@ -3,7 +3,7 @@ import logging
from homeassistant.helpers.entity import ToggleEntity
from .const import VS_SWITCHES
from .const import VS_FANS, VS_SWITCHES
_LOGGER = logging.getLogger(__name__)
@@ -12,9 +12,14 @@ async def async_process_devices(hass, manager):
"""Assign devices to proper component."""
devices = {}
devices[VS_SWITCHES] = []
devices[VS_FANS] = []
await hass.async_add_executor_job(manager.update)
if manager.fans:
devices[VS_FANS].extend(manager.fans)
_LOGGER.info("%d VeSync fans found", len(manager.fans))
if manager.outlets:
devices[VS_SWITCHES].extend(manager.outlets)
_LOGGER.info("%d VeSync outlets found", len(manager.outlets))
@@ -49,7 +54,7 @@ class VeSyncDevice(ToggleEntity):
@property
def is_on(self):
"""Return True if switch is on."""
"""Return True if device is on."""
return self.device.device_status == "on"
@property
@@ -57,10 +62,6 @@ class VeSyncDevice(ToggleEntity):
"""Return True if device is available."""
return self.device.connection_status == "online"
def turn_on(self, **kwargs):
"""Turn the device on."""
self.device.turn_on()
def turn_off(self, **kwargs):
"""Turn the device off."""
self.device.turn_off()