Handle incomplete Sonos alarm event payloads (#51353)

pull/51357/head
jjlawren 2021-06-01 15:28:56 -05:00 committed by GitHub
parent 12b8672f84
commit 9e3ee73b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -372,7 +372,8 @@ class SonosSpeaker:
@callback
def async_dispatch_alarms(self, event: SonosEvent) -> None:
"""Create a task to update alarms from an event."""
update_id = event.variables["alarm_list_version"]
if not (update_id := event.variables.get("alarm_list_version")):
return
if update_id in self.processed_alarm_events:
return
self.processed_alarm_events.append(update_id)