wip
This commit is contained in:
parent
f216ebd6db
commit
f7491bb79b
|
@ -2,6 +2,7 @@ from time import perf_counter
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from collections import deque
|
from collections import deque
|
||||||
import re
|
import re
|
||||||
|
from os.path import exists
|
||||||
|
|
||||||
# TODO client: add a way to disable live plotting? server: stop
|
# TODO client: add a way to disable live plotting? server: stop
|
||||||
# sending data periodically to everybody!
|
# sending data periodically to everybody!
|
||||||
|
@ -22,7 +23,6 @@ class Sensor():
|
||||||
|
|
||||||
class Temperature1W(Sensor):
|
class Temperature1W(Sensor):
|
||||||
def __init__(self, address):
|
def __init__(self, address):
|
||||||
super().__init__()
|
|
||||||
self.measure = 'Temperature'
|
self.measure = 'Temperature'
|
||||||
self.address = address
|
self.address = address
|
||||||
|
|
||||||
|
@ -30,7 +30,11 @@ class Temperature1W(Sensor):
|
||||||
return f'/sys/bus/w1/devices/{self.address}/w1_slave'
|
return f'/sys/bus/w1/devices/{self.address}/w1_slave'
|
||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
with open(self.path(), "r") as f:
|
path = self.path()
|
||||||
|
if not exists(path):
|
||||||
|
# WIP
|
||||||
|
return (perf_counter(), 0.0)
|
||||||
|
with open(path, "r") as f:
|
||||||
content = f.readlines()
|
content = f.readlines()
|
||||||
time = perf_counter()
|
time = perf_counter()
|
||||||
if len(content) < 2:
|
if len(content) < 2:
|
||||||
|
|
Loading…
Reference in New Issue