Skip to content

Commit

Permalink
Fix error handling in alerts/summary
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jul 15, 2024
1 parent 23511ec commit 487247d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lvmapi/routers/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ async def summary() -> AlertsSummary:
enclosure_alerts_response = await enclosure_alerts()
except Exception as err:
warnings.warn(f"Error getting enclosure alerts: {err}")
o2_alert = None
enclosure_alerts_response = {}

o2_alerts = {
key: value
for key, value in enclosure_alerts_response.items()
if "o2_percentage" in key
}
o2_alert = any(o2_alerts.values())

o2_alert = any(o2_alerts.values())
rain_sensor_alarm = enclosure_alerts_response.get("rain_sensor_alarm", None)

return AlertsSummary(
Expand Down

0 comments on commit 487247d

Please sign in to comment.