mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 01:17:42 +01:00
Added actiions for sensors and minor fix in mashsteps
- Actions can now also be called for sensors -> will require ui 0.0.18. - Some fixes for timer in mashsteps in case of pause is pressed
This commit is contained in:
parent
74fa65da29
commit
dd7da9ce71
3 changed files with 46 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
__version__ = "4.0.0.38"
|
__version__ = "4.0.0.39"
|
||||||
|
|
|
@ -73,6 +73,7 @@ class MashInStep(CBPiStep):
|
||||||
|
|
||||||
async def on_timer_done(self,timer):
|
async def on_timer_done(self,timer):
|
||||||
self.summary = ""
|
self.summary = ""
|
||||||
|
self.kettle.target_temp = 0
|
||||||
await self.push_update()
|
await self.push_update()
|
||||||
if self.AutoMode == True:
|
if self.AutoMode == True:
|
||||||
await self.setAutoMode(False)
|
await self.setAutoMode(False)
|
||||||
|
@ -152,6 +153,7 @@ class MashStep(CBPiStep):
|
||||||
|
|
||||||
async def on_timer_done(self,timer):
|
async def on_timer_done(self,timer):
|
||||||
self.summary = ""
|
self.summary = ""
|
||||||
|
self.kettle.target_temp = 0
|
||||||
if self.AutoMode == True:
|
if self.AutoMode == True:
|
||||||
await self.setAutoMode(False)
|
await self.setAutoMode(False)
|
||||||
self.cbpi.notify(self.name, 'Step finished', NotificationType.SUCCESS)
|
self.cbpi.notify(self.name, 'Step finished', NotificationType.SUCCESS)
|
||||||
|
@ -173,6 +175,10 @@ class MashStep(CBPiStep):
|
||||||
|
|
||||||
if self.cbpi.kettle is not None and self.timer is None:
|
if self.cbpi.kettle is not None and self.timer is None:
|
||||||
self.timer = Timer(int(self.props.get("Timer",0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done)
|
self.timer = Timer(int(self.props.get("Timer",0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done)
|
||||||
|
elif self.cbpi.kettle is not None and self.timer:
|
||||||
|
self.timer.start()
|
||||||
|
self.timer.is_running = True
|
||||||
|
|
||||||
self.summary = "Waiting for Target Temp"
|
self.summary = "Waiting for Target Temp"
|
||||||
await self.push_update()
|
await self.push_update()
|
||||||
|
|
||||||
|
@ -368,6 +374,9 @@ class BoilStep(CBPiStep):
|
||||||
|
|
||||||
if self.cbpi.kettle is not None and self.timer is None:
|
if self.cbpi.kettle is not None and self.timer is None:
|
||||||
self.timer = Timer(int(self.props.get("Timer", 0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done)
|
self.timer = Timer(int(self.props.get("Timer", 0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done)
|
||||||
|
elif self.cbpi.kettle is not None and self.timer:
|
||||||
|
self.timer.start()
|
||||||
|
self.timer.is_running = True
|
||||||
|
|
||||||
self.summary = "Waiting for Target Temp"
|
self.summary = "Waiting for Target Temp"
|
||||||
if self.AutoMode == True:
|
if self.AutoMode == True:
|
||||||
|
|
|
@ -229,3 +229,39 @@ class SensorHttpEndpoints():
|
||||||
logging.info(sensor_value)
|
logging.info(sensor_value)
|
||||||
return web.json_response(data=sensor_value)
|
return web.json_response(data=sensor_value)
|
||||||
|
|
||||||
|
@request_mapping(path="/{id}/action", method="POST", auth_required=auth)
|
||||||
|
async def http_action(self, request) -> web.Response:
|
||||||
|
"""
|
||||||
|
|
||||||
|
---
|
||||||
|
description: Call Action for Sensor
|
||||||
|
tags:
|
||||||
|
- Sensor
|
||||||
|
parameters:
|
||||||
|
- name: "id"
|
||||||
|
in: "path"
|
||||||
|
description: "Actor ID"
|
||||||
|
required: true
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: Update an actor
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
parameter:
|
||||||
|
type: object
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: successful operation
|
||||||
|
"""
|
||||||
|
sensor_id = request.match_info['id']
|
||||||
|
data = await request.json()
|
||||||
|
print(data)
|
||||||
|
await self.controller.call_action(sensor_id, data.get("action"), data.get("parameter"))
|
||||||
|
|
||||||
|
return web.Response(status=204)
|
||||||
|
|
Loading…
Reference in a new issue