WIP - Fix bug in state handling in Vera Switch and Light (#6931)
* Fix bug in state handling. * Tidy.
This commit is contained in:
parent
57a00c1fbf
commit
dcbc0b490c
2 changed files with 4 additions and 6 deletions
|
@ -8,7 +8,6 @@ import logging
|
|||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS)
|
||||
from homeassistant.const import (STATE_OFF, STATE_ON)
|
||||
from homeassistant.components.vera import (
|
||||
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
||||
|
||||
|
@ -53,13 +52,13 @@ class VeraLight(VeraDevice, Light):
|
|||
else:
|
||||
self.vera_device.switch_on()
|
||||
|
||||
self._state = STATE_ON
|
||||
self._state = True
|
||||
self.schedule_update_ha_state(True)
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
"""Turn the light off."""
|
||||
self.vera_device.switch_off()
|
||||
self._state = STATE_OFF
|
||||
self._state = False
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
@property
|
||||
|
|
|
@ -8,7 +8,6 @@ import logging
|
|||
|
||||
from homeassistant.util import convert
|
||||
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
|
||||
from homeassistant.const import (STATE_OFF, STATE_ON)
|
||||
from homeassistant.components.vera import (
|
||||
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
||||
|
||||
|
@ -36,13 +35,13 @@ class VeraSwitch(VeraDevice, SwitchDevice):
|
|||
def turn_on(self, **kwargs):
|
||||
"""Turn device on."""
|
||||
self.vera_device.switch_on()
|
||||
self._state = STATE_ON
|
||||
self._state = True
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
"""Turn device off."""
|
||||
self.vera_device.switch_off()
|
||||
self._state = STATE_OFF
|
||||
self._state = False
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Reference in a new issue