Skip to content

Commit b9da47c

Browse files
committed
viessmann: don't close connection on device protocol errors in _send()
1 parent 9cc1500 commit b9da47c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

viessmann/protocol.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,19 @@ def _send(self, data_dict, **kwargs):
319319
raise SDPConnectionError('no response from device after KW command')
320320
return self._parse_response(bytearray(chunk), data_dict['data']['value'] is None)
321321

322-
except SDPError:
322+
except SDPConnectionError:
323323
self._is_initialized = False
324324
try:
325325
self._close()
326326
except Exception:
327327
pass
328328
raise
329+
except SDPProtocolError:
330+
# Device responded with a protocol-level error (e.g. unknown command,
331+
# not-initialized). The serial link is intact — do NOT close it.
332+
# Reset init flag so the next send re-runs the P300 handshake.
333+
self._is_initialized = False
334+
raise
329335
except Exception as e:
330336
self._is_initialized = False
331337
try:

0 commit comments

Comments
 (0)