fix recipes

This commit is contained in:
Nicolò Balzarotti 2023-01-05 16:31:42 +01:00
parent 920822a74f
commit 1a64f3ed10
2 changed files with 30 additions and 36 deletions

View File

@ -24,10 +24,10 @@ def load_phase(json):
def fallback(v): def fallback(v):
return json.get(v, '#t') return json.get(v, '#t')
return Phase( return Phase(
json['name'], json['text'], json['name'], json['description'],
onexit=fallback('onexit'), onexit=fallback('on_exit'),
onload=fallback('onload'), onload=fallback('on_load'),
nextcond=fallback('nextcond')) nextcond=fallback('exit_condition'))
def load_recipe(json): def load_recipe(json):
return Recipe( return Recipe(

View File

@ -8,11 +8,10 @@
"phases": [ "phases": [
{ {
"name": "Hold", "name": "Hold",
"text": "Keep 23\u00b0C", "description": "Keep 23\u00b0C",
"nextcond": "(> (time-in-this-phase) (hours 10))", "exit_condition": "(> (time-in-this-phase) (hours 10))",
"current": false, "on_load": "(begin (set-controller \"heater\" \"T_food\")\n(set-target \"T_food\" 23.0))",
"onload": "(begin (set-controller \"heater\" \"T_food\")\n(set-target \"T_food\" 23.0))", "on_exit": "#t"
"onexit": "#t"
} }
] ]
}, },
@ -25,11 +24,10 @@
"phases": [ "phases": [
{ {
"name": "Hold", "name": "Hold",
"text": "Keep 35\u00b0C", "description": "Keep 35\u00b0C",
"nextcond": "(> (time-in-this-phase) (hours 20))", "exit_condition": "(> (time-in-this-phase) (hours 20))",
"current": false, "on_load": "(begin (set-controller \"heater\" \"T_food\")\n(set-target \"T_food\" 35.0))",
"onload": "(begin (set-controller \"heater\" \"T_food\")\n(set-target \"T_food\" 35.0))", "on_exit": "#t"
"onexit": "#t"
} }
] ]
}, },
@ -42,40 +40,36 @@
"phases": [ "phases": [
{ {
"name": "Riscalda", "name": "Riscalda",
"text": "Preheat yogurt to 82\u00b0", "description": "Preheat yogurt to 82°C",
"nextcond": "#t", "exit_condition": "(and (>= (get-sensor \"T_food\") 81.5)\n(> (time-in-this-phase) (minutes 15)))",
"current": false, "on_load": "(begin (set-controller \"heater\" \"T_food\")\n(set-target \"T_food\" 82.0))",
"onload": "#t", "on_exit": "#t"
"onexit": "#t"
}, },
{ {
"name": "Cool", "name": "Cool",
"text": "Cool to 46\u00b0", "description": "Cool to 46°C",
"nextcond": "(and (< (get-sensor \"T_food\") 46.0)\n(> (get-sensor \"T_food\") 42.0))", "exit_condition": "(and (< (get-sensor \"T_food\") 46.0)\n(> (get-sensor \"T_food\") 42.0))",
"current": false, "on_load": "(set-target \"T_food\" 46.0)",
"onload": "(set-target \"T_food\" 46.0)", "on_exit": "#t"
"onexit": "#t"
}, },
{ {
"name": "Inoculate", "name": "Inoculate (backslopping)",
"text": "Add 50ml Yogurt", "description": "Add 50ml Yogurt",
"nextcond": "(manual-intervention \"Inocula 50g di yogurt\" '((\"Fatto\" #t)))", "exit_condition": "(manual-intervention \"Inocula 50g di yogurt\" '((\"Fatto\" #t)))",
"current": false, "on_load": "(notify \"Inoculate 50g of yogurt NOW!\")",
"onload": "(notify \"Inoculate 50g of yogurt NOW!\")", "on_exit": "(notify (concat \"Inoculated at \" (now)))"
"onexit": "(notify (concat \"Inoculated at \" (now)))"
}, },
{ {
"name": "Hold", "name": "Hold",
"text": "Keep at 42\u00b0 for 3h", "description": "Keep at 42°C for 3h",
"nextcond": "(> (time-in-this-phase) (hours 3))", "exit_condition": "(> (time-in-this-phase) (hours 3))",
"current": false, "on_load": "(set-target \"T_food\" 41.0)",
"onload": "(set-target \"T_food\" 41.0)", "on_exit": "(notify \"You can remove the yogurt from the heater\")"
"onexit": "(notify \"You can remove the yogurt from the heater\")"
} }
] ]
}, },
{ {
"name": "Natt\u014d", "name": "Nattō",
"description": "FIXME", "description": "FIXME",
"controllers": [ "controllers": [
"(make-duty-controller \"heater\" 0.20 120)" "(make-duty-controller \"heater\" 0.20 120)"