Fix missing events for hue remotes (#34340)

pull/34347/head
Eugenio Panadero 2020-04-17 18:48:36 +02:00 committed by GitHub
parent 55af2ab4dc
commit 813f8dd63f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -31,8 +31,8 @@ class HueEvent(GenericHueDevice):
self.device_registry_id = None
self.event_id = slugify(self.sensor.name)
# Use the 'lastupdated' string to detect new remote presses
self._last_updated = self.sensor.lastupdated
# Use the aiohue sensor 'state' dict to detect new remote presses
self._last_state = dict(self.sensor.state)
# Register callback in coordinator and add job to remove it on bridge reset.
self.bridge.reset_jobs.append(
@ -45,7 +45,7 @@ class HueEvent(GenericHueDevice):
@callback
def async_update_callback(self):
"""Fire the event if reason is that state is updated."""
if self.sensor.lastupdated == self._last_updated:
if self.sensor.state == self._last_state:
return
# Extract the press code as state
@ -54,7 +54,7 @@ class HueEvent(GenericHueDevice):
else:
state = self.sensor.buttonevent
self._last_updated = self.sensor.lastupdated
self._last_state = dict(self.sensor.state)
# Fire event
data = {