1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

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:
Dima Zavin
2019-08-17 14:50:15 -07:00
committed by Martin Hjelmare
parent 9dff2e188b
commit 6bf35232b9
2 changed files with 3 additions and 4 deletions

View File

@@ -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