Explorar el Código

Merge pull request #50 from carlallen/patch-5

Allow blank value for offset on onewire sensor
tags/3.1_alpha
Manuel83 GitHub hace 8 años
padre
commit
dc046e92c4
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. +6
    -2
      modules/base_plugins/one_wire/__init__.py

+ 6
- 2
modules/base_plugins/one_wire/__init__.py Ver fichero

@@ -87,10 +87,14 @@ class ONE_WIRE_SENSOR(SensorPassive):

def read(self):
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:
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
def init_global(self):
try:


Cargando…
Cancelar
Guardar