mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-25 16:38:36 +01:00
Simplified offset handling
Change is somehow dependent dependent on issue #68 with corresponding change in dataclasses.py. But this is an example on how the change in dataclasses.py would allow to simplify the props handling in case of empty values.
This commit is contained in:
parent
55953539da
commit
0828aeacac
1 changed files with 1 additions and 6 deletions
|
@ -64,13 +64,8 @@ class OneWire(CBPiSensor):
|
||||||
await super().start()
|
await super().start()
|
||||||
self.name = self.props.get("Sensor")
|
self.name = self.props.get("Sensor")
|
||||||
self.interval = self.props.get("Interval", 60)
|
self.interval = self.props.get("Interval", 60)
|
||||||
self.offset = self.props.get("offset")
|
self.offset = float(self.props.get("offset",0))
|
||||||
if self.offset == "" or self.offset is None:
|
|
||||||
self.offset = 0
|
|
||||||
else:
|
|
||||||
self.offset = float(self.offset)
|
|
||||||
|
|
||||||
print(self.offset)
|
|
||||||
self.t = ReadThread(self.name)
|
self.t = ReadThread(self.name)
|
||||||
self.t.daemon = True
|
self.t.daemon = True
|
||||||
def shudown():
|
def shudown():
|
||||||
|
|
Loading…
Reference in a new issue