From 89aabdccd020d4a57fa860cc4a2a932f5667c344 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Fri, 17 Jul 2020 18:46:10 +0100 Subject: [PATCH] check for UnicodeDecodeError --- src/interfacers/EmonHubJeeInterfacer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/interfacers/EmonHubJeeInterfacer.py b/src/interfacers/EmonHubJeeInterfacer.py index b3911dc7..4dc312ed 100644 --- a/src/interfacers/EmonHubJeeInterfacer.py +++ b/src/interfacers/EmonHubJeeInterfacer.py @@ -81,8 +81,11 @@ def read(self): """ # Read serial RX - self._rx_buf = self._rx_buf + self._ser.readline().decode() - + try: + self._rx_buf = self._rx_buf + self._ser.readline().decode() + except UnicodeDecodeError: + return + # If line incomplete, exit if '\r\n' not in self._rx_buf: return