mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
Merge pull request #38 from carlallen/patch-3
Allow specifying an offset on onewire sensor
This commit is contained in:
@@ -67,6 +67,7 @@ class myThread (threading.Thread):
|
|||||||
class ONE_WIRE_SENSOR(SensorPassive):
|
class ONE_WIRE_SENSOR(SensorPassive):
|
||||||
|
|
||||||
sensor_name = Property.Select("Sensor", getSensors())
|
sensor_name = Property.Select("Sensor", getSensors())
|
||||||
|
offset = Property.Number("Offset", True, 0)
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
|
|
||||||
@@ -86,9 +87,9 @@ 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, 2))
|
self.data_received(round(self.t.value + float(self.offset), 2))
|
||||||
else:
|
else:
|
||||||
self.data_received(round(9.0 / 5.0 * self.t.value + 32, 2))
|
self.data_received(round(9.0 / 5.0 * self.t.value + 32 + float(self.offset), 2))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def init_global(self):
|
def init_global(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user