Fix Non-thread-safe operation in homekit light events (#62147)

This commit is contained in:
J. Nick Koston 2021-12-17 01:17:32 -06:00 committed by GitHub
parent c710958261
commit 8bf58df624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,10 +120,11 @@ class Light(HomeAccessory):
if self._event_timer: if self._event_timer:
self._event_timer() self._event_timer()
self._event_timer = async_call_later( self._event_timer = async_call_later(
self.hass, CHANGE_COALESCE_TIME_WINDOW, self._send_events self.hass, CHANGE_COALESCE_TIME_WINDOW, self._async_send_events
) )
def _send_events(self, *_): @callback
def _async_send_events(self, *_):
"""Process all changes at once.""" """Process all changes at once."""
_LOGGER.debug("Coalesced _set_chars: %s", self._pending_events) _LOGGER.debug("Coalesced _set_chars: %s", self._pending_events)
char_values = self._pending_events char_values = self._pending_events