mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +01:00
fix spunding hysteresis temp control
This commit is contained in:
parent
d63bbbb887
commit
da975f92b2
2 changed files with 18 additions and 15 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.0.5.a9"
|
||||
__version__ = "4.0.5.a10"
|
||||
__codename__ = "Spring Break"
|
||||
|
||||
|
|
|
@ -122,8 +122,6 @@ class FermenterHysteresis(CBPiFermenterLogic):
|
|||
class FermenterSpundingHysteresis(CBPiFermenterLogic):
|
||||
# subroutine that controls pressure
|
||||
async def pressure_control(self):
|
||||
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))
|
||||
|
@ -150,25 +148,15 @@ class FermenterSpundingHysteresis(CBPiFermenterLogic):
|
|||
else:
|
||||
logging.info("No valve or pressure sensor defined")
|
||||
|
||||
async def run(self):
|
||||
try:
|
||||
async def temperature_control(self):
|
||||
self.heater_offset_min = float(self.props.get("HeaterOffsetOn", 0))
|
||||
self.heater_offset_max = float(self.props.get("HeaterOffsetOff", 0))
|
||||
self.cooler_offset_min = float(self.props.get("CoolerOffsetOn", 0))
|
||||
self.cooler_offset_max = float(self.props.get("CoolerOffsetOff", 0))
|
||||
|
||||
self.fermenter = self.get_fermenter(self.id)
|
||||
self.heater = self.fermenter.heater
|
||||
self.cooler = self.fermenter.cooler
|
||||
|
||||
|
||||
heater = self.cbpi.actor.find_by_id(self.heater)
|
||||
cooler = self.cbpi.actor.find_by_id(self.cooler)
|
||||
|
||||
pressure_controller = asyncio.create_task(self.pressure_control())
|
||||
|
||||
await pressure_controller
|
||||
|
||||
while self.running == True:
|
||||
|
||||
sensor_value = float(self.get_sensor_value(self.fermenter.sensor).get("value"))
|
||||
|
@ -201,6 +189,19 @@ class FermenterSpundingHysteresis(CBPiFermenterLogic):
|
|||
|
||||
await asyncio.sleep(1)
|
||||
|
||||
async def run(self):
|
||||
try:
|
||||
self.fermenter = self.get_fermenter(self.id)
|
||||
self.heater = self.fermenter.heater
|
||||
self.cooler = self.fermenter.cooler
|
||||
self.valve = self.fermenter.valve
|
||||
|
||||
pressure_controller = asyncio.create_task(self.pressure_control())
|
||||
temperature_controller = asyncio.create_task(self.temperature_control())
|
||||
|
||||
await pressure_controller
|
||||
await temperature_controller
|
||||
|
||||
except asyncio.CancelledError as e:
|
||||
pass
|
||||
except Exception as e:
|
||||
|
@ -211,6 +212,8 @@ class FermenterSpundingHysteresis(CBPiFermenterLogic):
|
|||
await self.actor_off(self.heater)
|
||||
if self.cooler:
|
||||
await self.actor_off(self.cooler)
|
||||
if self.valve:
|
||||
await self.actor_off(self.valve)
|
||||
|
||||
def setup(cbpi):
|
||||
|
||||
|
|
Loading…
Reference in a new issue