fix 1W sensor reading
This commit is contained in:
parent
c45114f6f7
commit
14e4628727
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue