mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
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
@ -8,7 +8,6 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS)
|
ATTR_BRIGHTNESS, ENTITY_ID_FORMAT, Light, SUPPORT_BRIGHTNESS)
|
||||||
from homeassistant.const import (STATE_OFF, STATE_ON)
|
|
||||||
from homeassistant.components.vera import (
|
from homeassistant.components.vera import (
|
||||||
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
||||||
|
|
||||||
@ -53,13 +52,13 @@ class VeraLight(VeraDevice, Light):
|
|||||||
else:
|
else:
|
||||||
self.vera_device.switch_on()
|
self.vera_device.switch_on()
|
||||||
|
|
||||||
self._state = STATE_ON
|
self._state = True
|
||||||
self.schedule_update_ha_state(True)
|
self.schedule_update_ha_state(True)
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the light off."""
|
"""Turn the light off."""
|
||||||
self.vera_device.switch_off()
|
self.vera_device.switch_off()
|
||||||
self._state = STATE_OFF
|
self._state = False
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -8,7 +8,6 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.util import convert
|
from homeassistant.util import convert
|
||||||
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
|
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
|
||||||
from homeassistant.const import (STATE_OFF, STATE_ON)
|
|
||||||
from homeassistant.components.vera import (
|
from homeassistant.components.vera import (
|
||||||
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
||||||
|
|
||||||
@ -36,13 +35,13 @@ class VeraSwitch(VeraDevice, SwitchDevice):
|
|||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn device on."""
|
"""Turn device on."""
|
||||||
self.vera_device.switch_on()
|
self.vera_device.switch_on()
|
||||||
self._state = STATE_ON
|
self._state = True
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn device off."""
|
"""Turn device off."""
|
||||||
self.vera_device.switch_off()
|
self.vera_device.switch_off()
|
||||||
self._state = STATE_OFF
|
self._state = False
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user