Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions homeassistant/components/sensor/broadlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def __init__(self, interval, ip_addr, mac_addr, timeout):
self._device.timeout = timeout
self.update = Throttle(interval)(self._update)
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:
data = self._device.check_sensors_raw()
if (data is not None and data.get('humidity', 0) <= 100 and
Expand All @@ -127,11 +127,10 @@ def _update(self, retry=2):
if retry < 1:
_LOGGER.error(error)
return
if retry < 1 or not self._auth():
return
self._update(retry-1)
if retry > 0 and self._auth():
self._update(retry-1)

def _auth(self, retry=2):
def _auth(self, retry=3):
try:
auth = self._device.auth()
except socket.timeout:
Expand Down