Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/PiBrewing/craftbeerpi4
Browse files Browse the repository at this point in the history
… into development
  • Loading branch information
avollkopf committed Jan 3, 2025
2 parents 1c24a15 + a706c6d commit 54caf00
Show file tree
Hide file tree
Showing 9 changed files with 796 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cbpi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "4.4.9"
__codename__ = "Yeast Starter"
__version__ = "4.5.0.a2"
__codename__ = "Cross Country"

3 changes: 2 additions & 1 deletion cbpi/api/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def __str__(self):
def to_dict(self):

msg = self.instance.summary if self.instance is not None else ""
return dict(id=self.id, name=self.name, state_text=msg, type=self.type, status=self.status.value, props=self.props.to_dict())
msg2 = self.instance.summary2 if ((self.instance is not None) and (self.instance.summary2 is not None)) else None
return dict(id=self.id, name=self.name, state_text=msg, state_text2=msg2, type=self.type, status=self.status.value, props=self.props.to_dict())

@dataclass
class Fermenter:
Expand Down
1 change: 1 addition & 0 deletions cbpi/api/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, cbpi, id, name, props, on_done) -> None:
self.props = props
self.cancel_reason: StepResult = None
self.summary = ""
self.summary2 = None
self.task = None
self.running: bool = False
self.logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions cbpi/controller/log_file_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ async def get_data(self, names, sample_rate='60s'):
# remove duplicates
names = set(names)


result = None

def dateparse(time_in_secs):
Expand Down Expand Up @@ -120,7 +119,7 @@ def datetime_to_str(o):
data[name] = result.interpolate().tolist()

logging.info("Send Log for {}".format(names))

return data

async def get_data2(self, ids) -> dict:
Expand Down
754 changes: 754 additions & 0 deletions cbpi/extension/iSpindle/__init__.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions cbpi/extension/iSpindle/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: cbpi4-iSpindle
version: 4
active: true
26 changes: 24 additions & 2 deletions cbpi/extension/mashstep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ async def on_start(self):
#self.dwelltime=int(self.props.get("DwellTime", 0))*60
self.dwelltime=5*60 #tested with 5 minutes -> not exactly 5 min due to accuracy of asyncio.sleep
self.deviationlimit=0.3 # derived from a test
logging.warning(self.AutoTimer)
#logging.warning(self.AutoTimer)
self.summary2=None

self.kettle=self.get_kettle(self.props.get("Kettle", None))
if self.kettle is not None:
Expand All @@ -405,6 +406,24 @@ async def on_start(self):
await self.setAutoMode(True)
await self.push_update()

async def next_hop_timer(self):
hop_timers = []
for x in range(1, 6):
try:
hop = int(self.props.get("Hop_%s" % x, None)) * 60
except:
hop = None
if hop is not None:
hop_left = self.remaining_seconds - hop
if hop_left > 0:
hop_timers.append(hop_left)

if len(hop_timers) != 0:
next_hop_timer = time.strftime("%H:%M:%S", time.gmtime(min(hop_timers)))
else:
next_hop_timer = None
return next_hop_timer

async def check_hop_timer(self, number, value, text):
if value is not None and self.hops_added[number-1] is not True:
if self.remaining_seconds != None and self.remaining_seconds <= (int(value) * 60 + 1):
Expand All @@ -417,6 +436,7 @@ async def check_hop_timer(self, number, value, text):
async def on_stop(self):
await self.timer.stop()
self.summary = ""
self.summary2 = None
self.kettle.target_temp = 0
if self.AutoMode == True:
await self.setAutoMode(False)
Expand Down Expand Up @@ -456,7 +476,9 @@ async def run(self):
estimated_completion_time = datetime.fromtimestamp(time.time()+ (int(self.props.get("Timer", 0)))*60)
self.cbpi.notify(self.name, 'Timer started. Estimated completion: {}'.format(estimated_completion_time.strftime("%H:%M")), NotificationType.INFO)
else:
for x in range(1, 6):
nexthoptimer=await self.next_hop_timer()
self.summary2="Add Hop in: %s" % nexthoptimer if nexthoptimer is not None else None
for x in range(1, 6):
await self.check_hop_timer(x, self.props.get("Hop_%s" % x, None), self.props.get("Hop_%s_text" % x, None))

return StepResult.DONE
Expand Down
2 changes: 2 additions & 0 deletions cbpi/http_endpoints/http_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from cbpi.api.dataclasses import Props, Step
from aiohttp import web
from cbpi.api import *
import logging

class StepHttpEndpoints():

Expand All @@ -10,6 +11,7 @@ def __init__(self, cbpi):
self.controller : StepController = cbpi.step
self.cbpi.register(self, "/step2")

# Check if this is still needed
def create_dict(self, data):
return dict(name=data["name"], id=data["id"], type=data.get("type"), status=data["status"],props=data["props"], state_text=data["instance"].get_state())

Expand Down
7 changes: 7 additions & 0 deletions cbpi/http_endpoints/http_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ async def get_bf_list(self, request):
description: Get recipe list from Brewfather App
tags:
- Upload
parameters:
- name: "offset"
in: "path"
description: "offset for recipe list"
required: true
type: "integer"
format: "int64"
responses:
"200":
description: successful operation
Expand Down

0 comments on commit 54caf00

Please sign in to comment.