mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
Fix: Sensors are now stopping after update of config
This commit is contained in:
@@ -20,18 +20,14 @@ class DummyTempSensor(SensorActive):
|
|||||||
return "°C" if self.get_config_parameter("unit", "C") == "C" else "°F"
|
return "°C" if self.get_config_parameter("unit", "C") == "C" else "°F"
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
'''
|
SensorActive.stop(self)
|
||||||
Stop the sensor. Is called when the sensor config is updated or the sensor is deleted
|
|
||||||
:return:
|
|
||||||
'''
|
|
||||||
pass
|
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
'''
|
'''
|
||||||
Active sensor has to handle his own loop
|
Active sensor has to handle his own loop
|
||||||
:return:
|
:return:
|
||||||
'''
|
'''
|
||||||
while self.is_running():
|
while self.is_running() is True:
|
||||||
self.data_received(self.temp)
|
self.data_received(self.temp)
|
||||||
socketio.sleep(5)
|
socketio.sleep(5)
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,6 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
|||||||
for m in members:
|
for m in members:
|
||||||
if isinstance(tmpObj.__getattribute__(m), StepProperty.Number):
|
if isinstance(tmpObj.__getattribute__(m), StepProperty.Number):
|
||||||
t = tmpObj.__getattribute__(m)
|
t = tmpObj.__getattribute__(m)
|
||||||
print t.__dict__
|
|
||||||
#self.cache[key][name]["properties"].append(t.__dict__)
|
#self.cache[key][name]["properties"].append(t.__dict__)
|
||||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value})
|
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value})
|
||||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Text):
|
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Text):
|
||||||
|
|||||||
@@ -70,15 +70,16 @@ class SensorActive(SensorBase):
|
|||||||
__running = False
|
__running = False
|
||||||
|
|
||||||
def is_running(self):
|
def is_running(self):
|
||||||
|
|
||||||
return self.__running
|
return self.__running
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.__running = True
|
self.__running = True
|
||||||
print "INIT ACTIVE SENSOR"
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.__running = False
|
self.__running = False
|
||||||
|
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user