mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 14:45:09 +02:00
Simplify initial event retrieval
This commit is contained in:
@@ -440,12 +440,12 @@ class SimpliSafe:
|
|||||||
# websocket doesn't provide the most recent event, we grab it from the REST
|
# 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:
|
# API to ensure event-related attributes aren't empty on startup:
|
||||||
try:
|
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:
|
except SimplipyError as err:
|
||||||
_LOGGER.error("Error while fetching initial event: %s", err)
|
_LOGGER.error("Error while fetching initial event: %s", err)
|
||||||
self.initial_event_to_use[system.system_id] = {}
|
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):
|
async def refresh(event_time):
|
||||||
"""Refresh data from the SimpliSafe account."""
|
"""Refresh data from the SimpliSafe account."""
|
||||||
|
Reference in New Issue
Block a user