mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
improve error handling
This commit is contained in:
parent
1d7aea7120
commit
44a39636b1
@ -7,6 +7,7 @@ For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.eliqonline/
|
||||
"""
|
||||
import logging
|
||||
from urllib.error import URLError
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.const import (STATE_UNKNOWN, CONF_ACCESS_TOKEN, CONF_NAME)
|
||||
|
||||
@ -73,5 +74,5 @@ class EliqSensor(Entity):
|
||||
try:
|
||||
response = self.api.get_data_now(channelid=self.channel_id)
|
||||
self._state = int(response.power)
|
||||
except TypeError: # raised by eliqonline library on any HTTP error
|
||||
pass
|
||||
except (TypeError, URLError):
|
||||
_LOGGER.error("could not connect to the eliqonline servers")
|
||||
|
Loading…
x
Reference in New Issue
Block a user