fix 1W sensor reading
This commit is contained in:
parent
c45114f6f7
commit
14e4628727
|
@ -32,12 +32,13 @@ class Temperature1W(Sensor):
|
||||||
def read(self):
|
def read(self):
|
||||||
with open(self.path(), "r") as f:
|
with open(self.path(), "r") as f:
|
||||||
content = f.readlines()
|
content = f.readlines()
|
||||||
|
time = perf_counter()
|
||||||
if len(content) < 2:
|
if len(content) < 2:
|
||||||
return None
|
return None
|
||||||
if content[0].strip()[-3:] != "YES":
|
if content[0].strip()[-3:] != "YES":
|
||||||
print("INVALID CHECKSUM")
|
print("INVALID CHECKSUM")
|
||||||
return None
|
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():
|
class Sensors():
|
||||||
def __init__(self, history=2621440):
|
def __init__(self, history=2621440):
|
||||||
|
|
Loading…
Reference in New Issue