From 14e4628727c8650ce0c61a6306642c2f822ac756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Balzarotti?= Date: Sat, 19 Nov 2022 19:04:56 +0100 Subject: [PATCH] fix 1W sensor reading --- sensors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sensors.py b/sensors.py index d79d48b..63e7aaf 100644 --- a/sensors.py +++ b/sensors.py @@ -32,12 +32,13 @@ class Temperature1W(Sensor): def read(self): with open(self.path(), "r") as f: content = f.readlines() + time = perf_counter() if len(content) < 2: return None if content[0].strip()[-3:] != "YES": print("INVALID CHECKSUM") return None - return int(re.search("t=([0-9]+)", content[1]).group(1)) / 1000.0 + return (time, int(re.search("t=([0-9]+)", content[1]).group(1)) / 1000.0) class Sensors(): def __init__(self, history=2621440):