Migrate light component to async (#4635)
This commit is contained in:
parent
4c03d670c1
commit
bde7176b3c
11 changed files with 99 additions and 88 deletions
|
@ -115,7 +115,7 @@ class MySensorsLight(mysensors.MySensorsDeviceEntity, Light):
|
|||
# optimistically assume that light has changed state
|
||||
self._state = True
|
||||
self._values[set_req.V_LIGHT] = STATE_ON
|
||||
self.update_ha_state()
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _turn_on_dimmer(self, **kwargs):
|
||||
"""Turn on dimmer child device."""
|
||||
|
@ -135,7 +135,7 @@ class MySensorsLight(mysensors.MySensorsDeviceEntity, Light):
|
|||
# optimistically assume that light has changed state
|
||||
self._brightness = brightness
|
||||
self._values[set_req.V_DIMMER] = percent
|
||||
self.update_ha_state()
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _turn_on_rgb_and_w(self, hex_template, **kwargs):
|
||||
"""Turn on RGB or RGBW child device."""
|
||||
|
@ -165,7 +165,7 @@ class MySensorsLight(mysensors.MySensorsDeviceEntity, Light):
|
|||
self._white = white
|
||||
if hex_color:
|
||||
self._values[self.value_type] = hex_color
|
||||
self.update_ha_state()
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _turn_off_light(self, value_type=None, value=None):
|
||||
"""Turn off light child device."""
|
||||
|
@ -211,7 +211,7 @@ class MySensorsLight(mysensors.MySensorsDeviceEntity, Light):
|
|||
self._state = False
|
||||
self._values[value_type] = (
|
||||
STATE_OFF if set_req.V_LIGHT in self._values else value)
|
||||
self.update_ha_state()
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _update_light(self):
|
||||
"""Update the controller with values from light child."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue