mirror of https://github.com/home-assistant/core
Don't force a query to the main lutron repeater on update (#25939)
We only want to force a query if we don't have any previous state. Otherwise, we should be tracking the state via continuous status updates. For lights (not switches) the extra query was also superfluous since it was already querying on startup. We should probably have a timeout on that so at some point we'll requery in case remote end disconnected/rebooted, etc. Leaving for another PR.
This commit is contained in:
parent
9dff2e188b
commit
6bf35232b9
|
@ -34,7 +34,6 @@ class LutronLight(LutronDevice, Light):
|
|||
def __init__(self, area_name, lutron_device, controller):
|
||||
"""Initialize the light."""
|
||||
self._prev_brightness = None
|
||||
self._is_on = False
|
||||
super().__init__(area_name, lutron_device, controller)
|
||||
|
||||
@property
|
||||
|
@ -78,6 +77,5 @@ class LutronLight(LutronDevice, Light):
|
|||
|
||||
def update(self):
|
||||
"""Call when forcing a refresh of the device."""
|
||||
self._is_on = self._lutron_device.level > 0
|
||||
if self._prev_brightness is None:
|
||||
self._prev_brightness = to_hass_level(self._lutron_device.level)
|
||||
|
|
|
@ -23,7 +23,7 @@ class LutronSwitch(LutronDevice, SwitchDevice):
|
|||
|
||||
def __init__(self, area_name, lutron_device, controller):
|
||||
"""Initialize the switch."""
|
||||
self._is_on = False
|
||||
self._prev_state = None
|
||||
super().__init__(area_name, lutron_device, controller)
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
|
@ -48,4 +48,5 @@ class LutronSwitch(LutronDevice, SwitchDevice):
|
|||
|
||||
def update(self):
|
||||
"""Call when forcing a refresh of the device."""
|
||||
self._is_on = self._lutron_device.level > 0
|
||||
if self._prev_state is None:
|
||||
self._prev_state = self._lutron_device.level > 0
|
||||
|
|
Loading…
Reference in New Issue