From 4acb19fcc535aec0a8e301782cdd3821a24c06ec Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Mon, 4 Apr 2022 19:56:47 +0200 Subject: [PATCH] Added valve release time and pause as parameters --- cbpi/__init__.py | 2 +- cbpi/extension/FermenterHysteresis/__init__.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index a9ef99d..0a57ff7 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.0.5.a3" +__version__ = "4.0.5.a4" __codename__ = "Spring Break" diff --git a/cbpi/extension/FermenterHysteresis/__init__.py b/cbpi/extension/FermenterHysteresis/__init__.py index cb187e3..105499c 100644 --- a/cbpi/extension/FermenterHysteresis/__init__.py +++ b/cbpi/extension/FermenterHysteresis/__init__.py @@ -114,6 +114,8 @@ class FermenterHysteresis(CBPiFermenterLogic): Property.Number(label="CoolerOffsetOn", configurable=True, description="Offset as decimal number when the cooler is switched on. Should be greater then 'CoolerOffsetOff'. For example a value of 2 switches on the cooler if the current temperature is 2 degrees below the target temperature"), Property.Number(label="CoolerOffsetOff", configurable=True, description="Offset as decimal number when the cooler is switched off. Should be smaller then 'CoolerOffsetOn'. For example a value of 1 switches off the cooler if the current temperature is 1 degree below the target temperature"), Property.Number(label="SpundingOffsetOpen", configurable=True, description="Offset above target pressure as decimal number when the valve is opened"), + Property.Select(label="ValveRelease", options=[1,2,3,4,5],description="Valve Release time in seconds"), + Property.Select(label="Pause", options=[1,2,3,4,5],description="Pause time in seconds between valve release"), Property.Select(label="AutoStart", options=["Yes","No"],description="Autostart Fermenter on cbpi start"), Property.Sensor(label="sensor2",description="Optional Sensor for LCDisplay(e.g. iSpindle)")]) @@ -123,6 +125,8 @@ class FermenterSpundingHysteresis(CBPiFermenterLogic): self.fermenter = self.get_fermenter(self.id) self.valve = self.fermenter.valve self.spunding_offset=float(self.props.get("SpundingOffsetOpen",0)) + self.valverelease=int(self.props.get("ValveRelease",1)) + self.pause=int(self.props.get("Pause",2)) if self.valve and self.fermenter.pressure_sensor: valve = self.cbpi.actor.find_by_id(self.valve) @@ -136,9 +140,9 @@ class FermenterSpundingHysteresis(CBPiFermenterLogic): if current_pressure >= (target_pressure + self.spunding_offset): while current_pressure >= target_pressure: await self.actor_on(self.valve) - await asyncio.sleep(1) + await asyncio.sleep(self.valverelease) await self.actor_off(self.valve) - await asyncio.sleep(2) + await asyncio.sleep(self.pause) current_pressure = float(self.get_sensor_value(self.fermenter.pressure_sensor).get("value")) logging.info("Value higher than target: Spunding loop is running")