From 9b612664392cc754924ba66b839a211b1a595586 Mon Sep 17 00:00:00 2001 From: "S. Seegel" Date: Fri, 17 Jan 2020 22:34:42 +0000 Subject: [PATCH] catch BCD errors --- sensors.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sensors.py b/sensors.py index 6572ab5..a6625cf 100644 --- a/sensors.py +++ b/sensors.py @@ -66,8 +66,11 @@ class lacross(rawsensor): @staticmethod def Create(data): - if len(data[0]) >= 5 and len(data[0]) <= 8 and crc8(data[0]) == 0: - return lacross(data) + if (len(data[0]) < 5) or (crc8(data[0]) <> 0): + return + if (data[0][1] & 0x0F > 9) or (data[0][2] >> 4 > 9) or (data[0][2] & 0x0F > 9): + return + return lacross(data) class emt7110(rawsensor): def __init__(self, data):