From 07024d7fc3abe631a90f51e3fa659981346a6a58 Mon Sep 17 00:00:00 2001 From: BrauereiAlt <30777095+BrauereiAlt@users.noreply.github.com> Date: Sun, 7 Mar 2021 22:54:58 -0800 Subject: [PATCH] Add files via upload --- cbpi/extension/mashstep/__init__.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/cbpi/extension/mashstep/__init__.py b/cbpi/extension/mashstep/__init__.py index 05dd9eb..58fac61 100644 --- a/cbpi/extension/mashstep/__init__.py +++ b/cbpi/extension/mashstep/__init__.py @@ -11,18 +11,9 @@ import logging Property.Kettle(label="Kettle")]) class MashStep(CBPiStep): - @action(key="Custom RESET", parameters=[]) - async def custom_reset(self, **kwargs): - self.summary = "" - await self.push_update() + + - - @action(key="Custom Action", parameters=[Property.Number(label="Value", configurable=True)]) - async def custom_action(self, Value, **kwargs): - self.summary = "VALUE FROM ACTION {}".format(Value) - await self.push_update() - self.cbpi.notify("ACTION 2 CALLED".format(Value)) - async def on_timer_done(self,timer): self.summary = "" await self.next() @@ -50,22 +41,25 @@ class MashStep(CBPiStep): while True: await asyncio.sleep(1) sensor_value = self.get_sensor_value(self.props.Sensor) - if sensor_value.get("value") >= int(self.props.Temp) and self.timer == None: + if sensor_value.get("value") >= int(self.props.Temp) and self.timer.is_running is not True: self.timer.start() + self.timer.is_running = True return StepResult.DONE + + @parameters([Property.Number(label="Timer", description="Time in Minutes", configurable=True)]) class WaitStep(CBPiStep): @action(key="Custom Step Action", parameters=[]) async def hello(self, **kwargs): print("ACTION") - self.cbpi.notify("ACTION 1 CALLED") + @action(key="Custom Step Action 2", parameters=[]) async def hello2(self, **kwargs): print("ACTION2") - self.cbpi.notify("ACTION 2 CALLED") + async def on_timer_done(self,timer): self.summary = "" @@ -157,15 +151,16 @@ class BoilStep(CBPiStep): @action("Start Timer", []) async def star_timer(self): - self.cbpi.notify("Timer started") + self.timer.start() async def run(self): while True: await asyncio.sleep(1) sensor_value = self.get_sensor_value(self.props.Sensor) - if sensor_value is not None and sensor_value.get("value") >= int(self.props.Temp) and self.timer == None: + if sensor_value.get("value") >= int(self.props.Temp) and self.timer.is_running is not True: self.timer.start() + self.timer.is_running = True return StepResult.DONE def setup(cbpi):