From 1d89126944d556a970db7edf7d5b80bc9be24082 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Tue, 4 Feb 2020 21:41:21 -0700 Subject: [PATCH] Simplify initial event retrieval --- homeassistant/components/simplisafe/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/simplisafe/__init__.py b/homeassistant/components/simplisafe/__init__.py index 6b861468c65..5f510f8bd2d 100644 --- a/homeassistant/components/simplisafe/__init__.py +++ b/homeassistant/components/simplisafe/__init__.py @@ -440,12 +440,12 @@ class SimpliSafe: # websocket doesn't provide the most recent event, we grab it from the REST # API to ensure event-related attributes aren't empty on startup: try: - most_recent_event = await system.get_latest_event() + self.initial_event_to_use[ + system.system_id + ] = await system.get_latest_event() except SimplipyError as err: _LOGGER.error("Error while fetching initial event: %s", err) self.initial_event_to_use[system.system_id] = {} - else: - self.initial_event_to_use[system.system_id] = most_recent_event async def refresh(event_time): """Refresh data from the SimpliSafe account."""