forked from home-assistant/core
Fix missing events for hue remotes (#34340)
This commit is contained in:
@@ -31,8 +31,8 @@ class HueEvent(GenericHueDevice):
|
|||||||
self.device_registry_id = None
|
self.device_registry_id = None
|
||||||
|
|
||||||
self.event_id = slugify(self.sensor.name)
|
self.event_id = slugify(self.sensor.name)
|
||||||
# Use the 'lastupdated' string to detect new remote presses
|
# Use the aiohue sensor 'state' dict to detect new remote presses
|
||||||
self._last_updated = self.sensor.lastupdated
|
self._last_state = dict(self.sensor.state)
|
||||||
|
|
||||||
# Register callback in coordinator and add job to remove it on bridge reset.
|
# Register callback in coordinator and add job to remove it on bridge reset.
|
||||||
self.bridge.reset_jobs.append(
|
self.bridge.reset_jobs.append(
|
||||||
@@ -45,7 +45,7 @@ class HueEvent(GenericHueDevice):
|
|||||||
@callback
|
@callback
|
||||||
def async_update_callback(self):
|
def async_update_callback(self):
|
||||||
"""Fire the event if reason is that state is updated."""
|
"""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
|
return
|
||||||
|
|
||||||
# Extract the press code as state
|
# Extract the press code as state
|
||||||
@@ -54,7 +54,7 @@ class HueEvent(GenericHueDevice):
|
|||||||
else:
|
else:
|
||||||
state = self.sensor.buttonevent
|
state = self.sensor.buttonevent
|
||||||
|
|
||||||
self._last_updated = self.sensor.lastupdated
|
self._last_state = dict(self.sensor.state)
|
||||||
|
|
||||||
# Fire event
|
# Fire event
|
||||||
data = {
|
data = {
|
||||||
|
Reference in New Issue
Block a user