From e6b7429b59b678c9fa88241621e3a6658d5b2e5f Mon Sep 17 00:00:00 2001 From: kridgo <110250066+kridgo@users.noreply.github.com> Date: Fri, 30 Dec 2022 10:52:30 +0100 Subject: [PATCH] Exception to handle parsing of malformed packets --- enocean/communicators/serialcommunicator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/enocean/communicators/serialcommunicator.py b/enocean/communicators/serialcommunicator.py index ffe4201..6bc638d 100644 --- a/enocean/communicators/serialcommunicator.py +++ b/enocean/communicators/serialcommunicator.py @@ -36,7 +36,10 @@ def run(self): except serial.SerialException: self.logger.error('Serial port exception! (device disconnected or multiple access on port?)') self.stop() - self.parse() + try: + self.parse() + except Exception as e: + self.logger.error('Exception occured while parsing: ' + str(e)) time.sleep(0) self.__ser.close()