Added error handling for sense API timeouts (#15789)
* Added error handling for sense API timeouts * Moved imports in function * Moved imports to more appropriate function * Change exception to custom package version
This commit is contained in:
parent
9e21765173
commit
6d432d19fe
2 changed files with 8 additions and 3 deletions
|
@ -16,7 +16,7 @@ from homeassistant.helpers.entity import Entity
|
|||
from homeassistant.util import Throttle
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['sense_energy==0.3.1']
|
||||
REQUIREMENTS = ['sense_energy==0.4.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -139,7 +139,12 @@ class Sense(Entity):
|
|||
|
||||
def update(self):
|
||||
"""Get the latest data, update state."""
|
||||
self.update_sensor()
|
||||
from sense_energy import SenseAPITimeoutException
|
||||
try:
|
||||
self.update_sensor()
|
||||
except SenseAPITimeoutException:
|
||||
_LOGGER.error("Timeout retrieving data")
|
||||
return
|
||||
|
||||
if self._sensor_type == ACTIVE_TYPE:
|
||||
if self._is_production:
|
||||
|
|
|
@ -1265,7 +1265,7 @@ sendgrid==5.4.1
|
|||
sense-hat==2.2.0
|
||||
|
||||
# homeassistant.components.sensor.sense
|
||||
sense_energy==0.3.1
|
||||
sense_energy==0.4.1
|
||||
|
||||
# homeassistant.components.media_player.aquostv
|
||||
sharp_aquos_rc==0.3.2
|
||||
|
|
Loading…
Add table
Reference in a new issue