Skip to content

Commit 756ba38

Browse files
committed
Fix reconnect bug
1 parent 42b0e7a commit 756ba38

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/device.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def _run(self, once: bool = True) -> bool:
9191
# from now on some cyclig bahavior
9292
data = bytes.fromhex("000000030400009002")
9393
self._socket.sendall(data)
94+
self._empty_counter = 0
9495

9596
# If continous reading ping/pong needs to be run cyclic
9697
if not once:
@@ -103,7 +104,7 @@ def _run(self, once: bool = True) -> bool:
103104
while self._loop:
104105
response = self._socket.recv(1024)
105106
if self._empty_counter > ABORT_AFTER_CONSECUTIVE_EMPTY:
106-
_LOGGER.error("Too many empty consecutive packages")
107+
_LOGGER.warning("Too many empty consecutive packages")
107108
raise DeviceError("Too many empty consecutive packages")
108109
if len(response) == 0:
109110
self._empty_counter += 1
@@ -267,7 +268,7 @@ def get(self) -> float:
267268
return val
268269
except StatisticsError:
269270
return self._values[-1]
270-
_LOGGER.error("No match in outlier filter shall never happen!")
271+
_LOGGER.warning("No match in outlier filter shall never happen!")
271272
return self._values[-1]
272273

273274

0 commit comments

Comments
 (0)