Improve sense timeout exception handling (#33127)

asyncio.Timeout needs to be trapped as well
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-03-22 21:41:59 -07:00
1 parent 0b2a8bf79a
commit fa60e9b03b
4 files changed
+14 -11

No files matched your search

+2 -3
View File
@@ -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