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

+11 -3
View File
@@ -1,4 +1,4 @@
"""Support for Etekcity VeSync switches."""
"""Support for VeSync switches."""
import logging
from homeassistant.components.switch import SwitchEntity
@@ -55,7 +55,15 @@ def _async_setup_entities(devices, async_add_entities):
async_add_entities(dev_list, update_before_add=True)
class VeSyncSwitchHA(VeSyncDevice, SwitchEntity):
class VeSyncBaseSwitch(VeSyncDevice, SwitchEntity):
"""Base class for VeSync switch Device Representations."""
def turn_on(self, **kwargs):
"""Turn the device on."""
self.device.turn_on()
class VeSyncSwitchHA(VeSyncBaseSwitch, SwitchEntity):
"""Representation of a VeSync switch."""
def __init__(self, plug):
@@ -90,7 +98,7 @@ class VeSyncSwitchHA(VeSyncDevice, SwitchEntity):
self.smartplug.update_energy()
class VeSyncLightSwitch(VeSyncDevice, SwitchEntity):
class VeSyncLightSwitch(VeSyncBaseSwitch, SwitchEntity):
"""Handle representation of VeSync Light Switch."""
def __init__(self, switch):