minor broadlink fix (#6202)

This commit is contained in:
Daniel Høyer Iversen 2017-02-24 09:49:42 +01:00 committed by GitHub
parent e2e8b43902
commit c4f4a9a158

View File

@ -112,9 +112,9 @@ class BroadlinkData(object):
self._device.timeout = timeout self._device.timeout = timeout
self.update = Throttle(interval)(self._update) self.update = Throttle(interval)(self._update)
if not self._auth(): if not self._auth():
_LOGGER.error("Failed to connect to device.") _LOGGER.warning("Failed to connect to device.")
def _update(self, retry=2): def _update(self, retry=3):
try: try:
data = self._device.check_sensors_raw() data = self._device.check_sensors_raw()
if (data is not None and data.get('humidity', 0) <= 100 and if (data is not None and data.get('humidity', 0) <= 100 and
@ -127,11 +127,10 @@ class BroadlinkData(object):
if retry < 1: if retry < 1:
_LOGGER.error(error) _LOGGER.error(error)
return return
if retry < 1 or not self._auth(): if retry > 0 and self._auth():
return
self._update(retry-1) self._update(retry-1)
def _auth(self, retry=2): def _auth(self, retry=3):
try: try:
auth = self._device.auth() auth = self._device.auth()
except socket.timeout: except socket.timeout: