Fermentation controller will start step instead of logic after restart

This commit is contained in:
avollkopf 2022-02-26 23:08:45 +01:00
parent c5acb68c6b
commit ff37779863
5 changed files with 7 additions and 5 deletions

View file

@ -1 +1 @@
__version__ = "4.0.2.0.a3" __version__ = "4.0.2.0.a4"

View file

@ -156,6 +156,8 @@ class FermentationController:
name = item.get("name") name = item.get("name")
props = Props(item.get("props")) props = Props(item.get("props"))
status = StepState(item.get("status", "I")) status = StepState(item.get("status", "I"))
if status == StepState.ACTIVE:
status = StepState("S")
type = item.get("type") type = item.get("type")
try: try:

View file

@ -198,8 +198,8 @@ class StepController:
def get_types(self): def get_types(self):
result = {} result = {}
for key, value in self.types.items(): for key, value in self.types.items():
if "ferment" not in str(value.get("class")).lower(): #if "ferment" not in str(value.get("class")).lower():
result[key] = dict(name=value.get("name"), properties=value.get("properties"), actions=value.get("actions")) result[key] = dict(name=value.get("name"), properties=value.get("properties"), actions=value.get("actions"))
return result return result
def get_state(self): def get_state(self):

View file

@ -32,7 +32,7 @@ class FermenterAutostart(CBPiExtension):
self.fermenter=self.cbpi.fermenter._find_by_id(fermenter_id) self.fermenter=self.cbpi.fermenter._find_by_id(fermenter_id)
try: try:
if (self.fermenter.instance is None or self.fermenter.instance.state == False): if (self.fermenter.instance is None or self.fermenter.instance.state == False):
await self.cbpi.fermenter.toggle(self.fermenter.id) await self.cbpi.fermenter.start(self.fermenter.id)
logging.info("Successfully switched on Ferenterlogic for Fermenter {}".format(self.fermenter.id)) logging.info("Successfully switched on Ferenterlogic for Fermenter {}".format(self.fermenter.id))
except Exception as e: except Exception as e:
logging.error("Failed to switch on FermenterLogic {} {}".format(self.fermenter.id, e)) logging.error("Failed to switch on FermenterLogic {} {}".format(self.fermenter.id, e))

View file

@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
try: try:
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
except Exception: except Exception:
logger.error("Failed to load RPi.GPIO. Using Mock") logger.warning("Failed to load RPi.GPIO. Using Mock")
MockRPi = MagicMock() MockRPi = MagicMock()
modules = { modules = {
"RPi": MockRPi, "RPi": MockRPi,