mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 21:44:57 +01:00
Fix for Property Type Fermenter
-> allows usage of property.ferenter in sensors, steps,....
This commit is contained in:
parent
ba42027e75
commit
e43aaf4fcd
6 changed files with 17 additions and 7 deletions
|
@ -1 +1 @@
|
||||||
__version__ = "4.0.1.a3"
|
__version__ = "4.0.1.a4"
|
||||||
|
|
|
@ -137,7 +137,9 @@ class Fermenter:
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
def to_dict(self):
|
||||||
|
|
||||||
if self.instance is not None:
|
if self.instance is not None:
|
||||||
|
|
|
@ -126,3 +126,4 @@ class Property(object):
|
||||||
self.label = label
|
self.label = label
|
||||||
self.configurable = True
|
self.configurable = True
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
import json
|
import json
|
||||||
from cbpi.api.dataclasses import Actor, Props
|
from cbpi.api.dataclasses import Fermenter, Actor, Props
|
||||||
import sys, os
|
import sys, os
|
||||||
import shortuuid
|
import shortuuid
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
|
@ -102,6 +102,8 @@ class PluginController():
|
||||||
return {"label": p.label, "type": "sensor", "configurable": p.configurable, "description": p.description}
|
return {"label": p.label, "type": "sensor", "configurable": p.configurable, "description": p.description}
|
||||||
elif isinstance(p, Property.Kettle):
|
elif isinstance(p, Property.Kettle):
|
||||||
return {"label": p.label, "type": "kettle", "configurable": p.configurable, "description": p.description}
|
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):
|
def _parse_step_props(self, cls, name):
|
||||||
|
|
||||||
|
@ -162,6 +164,11 @@ class PluginController():
|
||||||
result["properties"].append(
|
result["properties"].append(
|
||||||
{"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable,
|
{"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable,
|
||||||
"description": t.description})
|
"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():
|
for method_name, method in cls.__dict__.items():
|
||||||
if hasattr(method, "action"):
|
if hasattr(method, "action"):
|
||||||
|
|
|
@ -28,10 +28,10 @@ class SystemHttpEndpoints:
|
||||||
description: successful operation
|
description: successful operation
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
fermenter=self.cbpi.fermenter.get_state()
|
sensor=self.cbpi.sensor.get_state()
|
||||||
logging.info(fermenter)
|
logging.info(sensor)
|
||||||
except:
|
except:
|
||||||
logging.info("!!!!!!!!!!!!!!!!!!!!!!!!!Error get fermenter state!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
logging.info("!!!!!!!!!!!!!!!!!!!!!!!!!Error get sensor state!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
|
|
||||||
return web.json_response(data=dict(
|
return web.json_response(data=dict(
|
||||||
actor=self.cbpi.actor.get_state(),
|
actor=self.cbpi.actor.get_state(),
|
||||||
|
|
Loading…
Reference in a new issue