Merge pull request #1281 from molobrakos/eliqonline

improve error handling
This commit is contained in:
Paulus Schoutsen
2016-02-16 11:24:36 -08:00

View File

@@ -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")