Handle Uncaught exceptions in async_update Honeywell (#90746)

pull/90927/head
mkmer 2023-04-06 04:44:13 -04:00 committed by GitHub
parent 03e9cb233f
commit 3d426e1e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -1,9 +1,11 @@
"""Support for Honeywell (US) Total Connect Comfort climate systems."""
from __future__ import annotations
import asyncio
import datetime
from typing import Any
from aiohttp import ClientConnectionError
import aiosomecomfort
from homeassistant.components.climate import (
@ -421,10 +423,7 @@ class HoneywellUSThermostat(ClimateEntity):
try:
await self._device.refresh()
self._attr_available = True
except (
aiosomecomfort.SomeComfortError,
OSError,
):
except aiosomecomfort.SomeComfortError:
try:
await self._data.client.login()
@ -433,5 +432,12 @@ class HoneywellUSThermostat(ClimateEntity):
await self.hass.async_create_task(
self.hass.config_entries.async_reload(self._data.entry_id)
)
except aiosomecomfort.SomeComfortError:
except (
aiosomecomfort.SomeComfortError,
ClientConnectionError,
asyncio.TimeoutError,
):
self._attr_available = False
except (ClientConnectionError, asyncio.TimeoutError):
self._attr_available = False