mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
Allow blank value for offset on onewire sensor
Fixes bug caused introduced when adding the offset (temps only reading 0)
This commit is contained in:
@@ -87,10 +87,14 @@ class ONE_WIRE_SENSOR(SensorPassive):
|
|||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
if self.get_config_parameter("unit", "C") == "C":
|
if self.get_config_parameter("unit", "C") == "C":
|
||||||
self.data_received(round(self.t.value + float(self.offset), 2))
|
self.data_received(round(self.t.value + self.offset_value(), 2))
|
||||||
else:
|
else:
|
||||||
self.data_received(round(9.0 / 5.0 * self.t.value + 32 + float(self.offset), 2))
|
self.data_received(round(9.0 / 5.0 * self.t.value + 32 + self.offset_value(), 2))
|
||||||
|
|
||||||
|
@cbpi.try_catch(0)
|
||||||
|
def offset_value(self):
|
||||||
|
return float(self.offset)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def init_global(self):
|
def init_global(self):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user