61 lines
1.3 KiB
Python
61 lines
1.3 KiB
Python
from __future__ import annotations
|
|
from typing import Union
|
|
|
|
from enum import Enum
|
|
|
|
class Recipe:
|
|
def __init__(self, name: str, steps: list[Step]):
|
|
self.name = name
|
|
self.steps = steps + [Step(StepType.SECTION, "Enjoy")]
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class StepType(Enum):
|
|
SECTION = 0
|
|
WEIGH = 1
|
|
START_TIME = 2
|
|
WAIT_TIME_FINISHED = 3
|
|
TARE = 4
|
|
|
|
class Step:
|
|
|
|
def __init__(self,
|
|
step_type: StepType,
|
|
value: float | str = None):
|
|
self.step_type = step_type
|
|
self.value = value
|
|
|
|
|
|
###### example recipes #########
|
|
V60 = Recipe(
|
|
"V60",
|
|
[
|
|
Step(StepType.SECTION, "Grind"),
|
|
Step(StepType.TARE),
|
|
Step(StepType.WEIGH, 15),
|
|
|
|
Step(StepType.SECTION, "Brew"),
|
|
Step(StepType.TARE),
|
|
Step(StepType.START_TIME, 45),
|
|
Step(StepType.WEIGH, 50),
|
|
Step(StepType.WAIT_TIME_FINISHED),
|
|
Step(StepType.START_TIME, -1),
|
|
Step(StepType.WEIGH, 250),
|
|
]
|
|
)
|
|
|
|
ESPRESSO = Recipe(
|
|
"Espresso",
|
|
[
|
|
Step(StepType.SECTION, "Grind"),
|
|
Step(StepType.TARE),
|
|
Step(StepType.WEIGH, 18),
|
|
|
|
Step(StepType.SECTION, "Brew"),
|
|
Step(StepType.TARE),
|
|
Step(StepType.START_TIME, -1),
|
|
Step(StepType.WEIGH, 40),
|
|
]
|
|
) |