pknx icon indicating copy to clipboard operation
pknx copied to clipboard

keep_alive throws exception after losing connection

Open automat115 opened this issue 8 years ago • 5 comments

I have a connection to a KNX IP router with a keep alive thread running in the background. It sends heartbeats for a while, then finds no active connection and at the next heartbeat, throws an exception as seen below.

DEBUG:root:Heartbeat: Send connection state request
DEBUG:root:Heartbeat: Successful
DEBUG:root:Heartbeat: Send connection state request
DEBUG:root:Heartbeat: Successful
DEBUG:root:Heartbeat: Send connection state request
ERROR:root:Heartbeat: Response No active connection found for Channel:5 
DEBUG:root:Heartbeat: Send connection state request
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/.../knxip/ip.py", line 272, in keepalive
    self.check_connection_state()
  File "/Users/.../knxip/ip.py", line 436, in check_connection_state
    self.control_socket.sendto(bytes(frame.to_frame()),
  File "/Users/.../knxip/ip.py", line 58, in to_frame
    return bytearray(self.header() + self.body)
TypeError: can only concatenate list (not "bytes") to list

automat115 avatar Nov 09 '16 16:11 automat115