Improve sense timeout exception handling (#33127)
asyncio.Timeout needs to be trapped as well
This commit is contained in:
1 parent
0b2a8bf79a
commit
fa60e9b03b
4 files changed
+14
-11
No files matched your search
@@ -2,8 +2,6 @@
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from sense_energy import SenseAPITimeoutException
|
||||
|
||||
from homeassistant.const import DEVICE_CLASS_POWER, ENERGY_KILO_WATT_HOUR, POWER_WATT
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
@@ -24,6 +22,7 @@ from .const import (
|
||||
SENSE_DEVICE_UPDATE,
|
||||
SENSE_DEVICES_DATA,
|
||||
SENSE_DISCOVERED_DEVICES_DATA,
|
||||
SENSE_TIMEOUT_EXCEPTIONS,
|
||||
)
|
||||
|
||||
MIN_TIME_BETWEEN_DAILY_UPDATES = timedelta(seconds=300)
|
||||
@@ -256,7 +255,7 @@ class SenseTrendsSensor(Entity):
|
||||
|
||||
try:
|
||||
await self.update_sensor()
|
||||
except SenseAPITimeoutException:
|
||||
except SENSE_TIMEOUT_EXCEPTIONS:
|
||||
_LOGGER.error("Timeout retrieving data")
|
||||
return
|
||||
|
||||
|
||||
Reference in new issue
Block a user