mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
commit
b870980456
@ -26,12 +26,11 @@ class TuyaSwitch(TuyaDevice, SwitchDevice):
|
|||||||
"""Init Tuya switch device."""
|
"""Init Tuya switch device."""
|
||||||
super().__init__(tuya)
|
super().__init__(tuya)
|
||||||
self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
|
self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
|
||||||
self._is_on = False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if switch is on."""
|
"""Return true if switch is on."""
|
||||||
return self._is_on
|
return self.tuya.state()
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the switch on."""
|
"""Turn the switch on."""
|
||||||
@ -40,7 +39,3 @@ class TuyaSwitch(TuyaDevice, SwitchDevice):
|
|||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the device off."""
|
"""Turn the device off."""
|
||||||
self.tuya.turn_off()
|
self.tuya.turn_off()
|
||||||
|
|
||||||
def update(self):
|
|
||||||
"""Update switch device."""
|
|
||||||
self._is_on = self.tuya.state()
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 98
|
MINOR_VERSION = 98
|
||||||
PATCH_VERSION = "3"
|
PATCH_VERSION = "4"
|
||||||
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
|
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
|
||||||
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
|
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
|
||||||
REQUIRED_PYTHON_VER = (3, 6, 0)
|
REQUIRED_PYTHON_VER = (3, 6, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user