Fix for Property Type Fermenter

-> allows usage of property.ferenter in sensors, steps,....
This commit is contained in:
avollkopf 2022-01-02 17:08:23 +01:00
parent ba42027e75
commit e43aaf4fcd
6 changed files with 17 additions and 7 deletions

View file

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

View file

@ -137,7 +137,9 @@ class Fermenter:
def __str__(self):
return "id={} name={} sensor={} heater={} cooler={} brewname={} props={} temp={} type={} steps={}".format(self.id, self.name, self.sensor, self.heater, self.cooler, self.brewname, self.props, self.target_temp, self.type, self.steps)
return "name={} props={} temp={}".format(self.name, self.props, self.target_temp)
# return "id={} name={} sensor={} heater={} cooler={} brewname={} props={} temp={} type={} steps={}".format(self.id, self.name, self.sensor, self.heater, self.cooler, self.brewname, self.props, self.target_temp, self.type, self.steps)
def to_dict(self):
if self.instance is not None:

View file

@ -125,4 +125,5 @@ class Property(object):
PropertyType.__init__(self)
self.label = label
self.configurable = True
self.description = description
self.description = description

View file

@ -2,7 +2,7 @@
import logging
import os.path
import json
from cbpi.api.dataclasses import Actor, Props
from cbpi.api.dataclasses import Fermenter, Actor, Props
import sys, os
import shortuuid
import asyncio

View file

@ -102,6 +102,8 @@ class PluginController():
return {"label": p.label, "type": "sensor", "configurable": p.configurable, "description": p.description}
elif isinstance(p, Property.Kettle):
return {"label": p.label, "type": "kettle", "configurable": p.configurable, "description": p.description}
elif isinstance(p, Property.Fermenter):
return {"label": p.label, "type": "fermenter", "configurable": p.configurable, "description": p.description}
def _parse_step_props(self, cls, name):
@ -162,6 +164,11 @@ class PluginController():
result["properties"].append(
{"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable,
"description": t.description})
elif isinstance(tmpObj.__getattribute__(m), Property.Fermenter):
t = tmpObj.__getattribute__(m)
result["properties"].append(
{"name": m, "label": t.label, "type": "fermenter", "configurable": t.configurable,
"description": t.description})
for method_name, method in cls.__dict__.items():
if hasattr(method, "action"):

View file

@ -28,10 +28,10 @@ class SystemHttpEndpoints:
description: successful operation
"""
try:
fermenter=self.cbpi.fermenter.get_state()
logging.info(fermenter)
sensor=self.cbpi.sensor.get_state()
logging.info(sensor)
except:
logging.info("!!!!!!!!!!!!!!!!!!!!!!!!!Error get fermenter state!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
logging.info("!!!!!!!!!!!!!!!!!!!!!!!!!Error get sensor state!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
return web.json_response(data=dict(
actor=self.cbpi.actor.get_state(),