- Fermenter Controller Fix

- Kettle Controller Fix
- Remove SQL Alchemie
This commit is contained in:
Manuel83
2017-06-12 22:53:49 +02:00
parent 83a7628248
commit 4f95309a28
7 changed files with 67 additions and 30 deletions
+10 -2
View File
@@ -26,6 +26,14 @@ class Kettle2View(BaseView):
def post_post_callback(self, m):
m.state = False
def pre_put_callback(self, m):
try:
m.instance.stop()
except:
pass
def post_put_callback(self, m):
m.state = False
@route('/<int:id>/targettemp/<temp>', methods=['POST'])
def postTargetTemp(self, id, temp):
@@ -47,7 +55,7 @@ class Kettle2View(BaseView):
cfg.update(dict(api=cbpi, kettle_id=kettle.id, heater=kettle.heater, sensor=kettle.sensor))
instance = cbpi.get_controller(kettle.logic).get("class")(**cfg)
instance.init()
kettle.controller_instance = instance
kettle.instance = instance
def run(instance):
instance.run()
t = self.api.socketio.start_background_task(target=run, instance=instance)
@@ -55,7 +63,7 @@ class Kettle2View(BaseView):
cbpi.emit("UPDATE_KETTLE", cbpi.cache.get("kettle").get(id))
else:
# Stop controller
kettle.controller_instance.stop()
kettle.instance.stop()
kettle.state = not kettle.state
cbpi.emit("UPDATE_KETTLE", cbpi.cache.get("kettle").get(id))
return ('', 204)