Fix missing events for hue remotes (#34340)
parent
55af2ab4dc
commit
813f8dd63f
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue