From b2a2c66f41928d795f2a9cc65425ee04facc7b75 Mon Sep 17 00:00:00 2001 From: William Floyd Date: Mon, 9 Jul 2018 22:08:40 -0400 Subject: [PATCH] rice: Various. --- content/post/smart-rice-cooker.md | 58 ++-- src/connections.dot | 108 +++----- static/images/rice/connections.svg | 415 +++++++++++++---------------- 3 files changed, 273 insertions(+), 308 deletions(-) diff --git a/content/post/smart-rice-cooker.md b/content/post/smart-rice-cooker.md index d4d8450..2245039 100644 --- a/content/post/smart-rice-cooker.md +++ b/content/post/smart-rice-cooker.md @@ -55,20 +55,42 @@ Everything about it is like any other hot pot, it's just tuned for cooking rice. Thus, once I convert the thing to being smart, I will be able to use it for, say, ramen, or any number of other things. The possibility of steaming things only furthers this goal. +## Recipe Submission + +Wrap the JSON as an object so that flags and things can be passed along without modifying the recipe. + +Recipe IDs are handled internally by the cooker, as a hash of the contents. + +When submitting a recipe, the server will return the ID of the recipe, so the client may immediately attempt to start a recipe, but flags such as `delete-on-complete` make sure that recipes may be temporary in nature and not stay in history (parametric recipes are a prime example) + ## Recipes Recipes should be submitted as simple JSON structures. -These may be linted, and will contain no logic. +These may be linted prior to submission, and will contain no logic. All calculations are to be done when producing the recipe. This is done so as to ease the technical burden on the cooker. +## Tuning + +Heating should be tuned through the frontend. +A wattage value may be submitted as a rough guide. + +Otherwise, say how much water you put in, it will heat up until a threshold temperature is reached. +Wait until the heat dropping is stable (thermal lag needs to be gotten rid of), then read temperature. +Given this information, the cooker may then calculate the heating rate of the hot pot, as the thermal capacity of the water is known, and the thermal lag is mostly taken care of. + +This information may be used for ballpark estimates for cooking duration, when accounting for the time it takes to reach temperature. +Examples of use might be scheduling a recipe in time to get home. + +However, more useful will be using prior cooking runs to average the cooking times. + ## Heating / Cooling Active cooling is not something worth designing for, as it is not an issue to begin with. ## Coding -Internally, a temperature kill switch should be enacted, which will kick in if the +Internally, a temperature kill switch should be enacted, which will kick in if the temperature gets too high. *** @@ -76,20 +98,15 @@ Internally, a temperature kill switch should be enacted, which will kick in if t I tentatively (with no real experience designing them) plan on my API being something like the following. -- `/action/light/kill` - *Kill all light activity* -- `/action/light/set` - *Change lighting mode, with optional duration* -- `/action/temperature/kill` - *Stops all heating* -- `/action/temperature/set` - *Heat/cool to given temperature.* -- `/routine/cook/kill` - *Kill any current running routine* -- `/routine/cook/list` - *List known cooking routines* -- `/routine/cook/schedule/list` - *List any scheduled routines* -- `/routine/cook/schedule/set` - *Submit/modify/delete a scheduled routine* -- `/routine/cook/start` - *Start a routine* +- `/cookbook/add` - *Add a recipe* +- `/cookbook/delete` - *Delete a recipe* +- `/cookbook/list` - *List known recipes* +- `/action/kill` - *Kill any current running recipe* +- `/action/start` - *Start a recipe* +- `/action/schedule/add` - *Schedule a recipe* +- `/action/schedule/delete` *Delete a scheduled recipe* +- `/action/schedule/list` - *List scheduled recipes* - `/sensor/temperature` - *Returns temperature* -- `/settings/cook/recipe/list` - *List known cooking routines* -- `/settings/cook/recipe/set` - *Submit/modify/delete a cooking routine* -- `/settings/lighting/list` - *List lighting modes* -- `/settings/lighting/set` - *Submit/modify/delete a lighting mode* - `/settings/time/set` - *Set/read date and time* # Cooking recipe definition specifications @@ -115,13 +132,17 @@ These are defined as such: ### Sleep Wait for a given duration. -No need to expose to recipes directly, see `Kill`, `Temperature Change`, and `Temperature Hold` instead. +No need to expose to recipes directly, see `Temperature Kill`, `Temperature Change`, and `Temperature Hold` instead. Will keep things like LED lights going still. ### Heat Takes a bool, turns the heating element on or off. Non-blocking so that conditions may be checked without unnecessarily cycling the relay. -Dangerous to expose to recipes directly, see `Kill` +Dangerous to expose to recipes directly, see `Temperature Kill` + +### All Kill +Mostly to be used as a soft kill switch, invoked from a physical button or via API. +Proxy to `Temperature Kill` and `Lighting Kill`, then exits any current recipe. ### Lighting Change Change lighting mode. @@ -141,12 +162,11 @@ This should just be a proxy directive to `Heat` and `Sleep`. That is, `Heat` if under temp, `Sleep` if over temp, until an internal clock has ticked over the time required. ### Temperature Kill -Turns off heat, cancels any running recipe. +Turns off heat. Takes no input. Just a proxy to `Heat`, but only as a false bool. *Might* be used at the end of a recipe, unnecessary though. -Mostly to be used as a soft kill switch, invoked from a physical button or via API. Examples might be canceling an infinite temperature holding cycle (e.g rice warming). # Dep Graph diff --git a/src/connections.dot b/src/connections.dot index 756f292..a2743e7 100644 --- a/src/connections.dot +++ b/src/connections.dot @@ -42,11 +42,25 @@ digraph { } subgraph cluster_secondary { + + "All Kill" + "Lighting Change" "Lighting Kill" - "Temperature Kill" - "Temperature Change" - "Temperature Hold" + + subgraph cluster_directives_lighting { + "Lighting Change" + "Lighting Kill" + label="Lighting" + } + + subgraph cluster_directives_temperature { + "Temperature Change" + "Temperature Hold" + "Temperature Kill" + label="Temperature" + } + label="Secondary" } @@ -63,29 +77,7 @@ digraph { } subgraph cluster_api { - - subgraph cluster_action { - - subgraph cluster_light { - - "/api/action/light/kill"[label="kill"] - "/api/action/light/set"[label="set"] - - label="light" - - } - - subgraph cluster_temperature { - - "/api/action/temperature/kill"[label="kill"] - "/api/action/temperature/set"[label="set"] - - label="temperature" - - } - label="action" - } subgraph cluster_api_sensor { @@ -95,26 +87,22 @@ digraph { } - subgraph cluster_routine { + subgraph cluster_recipe { + + "/api/recipe/list"[label="list"] + "/api/recipe/start"[label="start"] + "/api/recipe/kill"[label="kill"] - subgraph cluster_routine_cook { + subgraph cluster_schedule { - "/api/routine/cook/list"[label="list"] - "/api/routine/cook/start"[label="start"] - "/api/routine/cook/kill"[label="kill"] + "/api/recipe/schedule/add"[label="add"] + "/api/recipe/schedule/delete"[label="delete"] + "/api/recipe/schedule/list"[label="list"] - subgraph cluster_schedule { - - "/api/routine/cook/schedule/list"[label="list"] - "/api/routine/cook/schedule/set"[label="set"] - - label="schedule" - } - - label="cook" + label="schedule" } - label="routine" + label="recipe" } subgraph cluster_settings { @@ -138,18 +126,12 @@ digraph { } - subgraph cluster_settings_cook { - subgraph cluster_recipe { + subgraph cluster_settings_recipe { + + "/api/settings/recipe/set"[label="set"] - "/api/settings/cook/recipe/list"[label="list"] - "/api/settings/cook/recipe/set"[label="set"] - - label="recipe" - - } - - label="cook" + label="recipe" } @@ -160,34 +142,30 @@ digraph { label="api" } + "All Kill" -> { "Temperature Kill" "Lighting Kill" }[proxy_function] "Temperature Change" -> { "Heat" "Sleep" }[depend_function] "Temperature Hold" -> { "Heat" "Sleep" }[depend_function] "Temperature Kill" -> "Heat"[proxy_function] { "Temperature Change" "Temperature Hold" } -> "Temperature"[depend_value] + "/api/recipe/kill" -> "All Kill"[proxy_function] - "/api/action/temperature/set" -> "Temperature Change"[proxy_function] - "/api/action/temperature/kill" -> "Temperature Kill"[proxy_function] - "/api/action/temperature/kill" -> "Temperature"[proxy_value] - "/api/routine/cook/list" -> "/api/settings/cook/recipe/list"[proxy_value] + "/api/sensor/temperature" -> "Temperature"[proxy_value] // Description checklist /////////////////////////////////////////////////////// -"/api/action/light/kill"[documented] -"/api/action/light/set"[documented] -"/api/action/temperature/kill"[documented] -"/api/action/temperature/set"[documented] -"/api/routine/cook/kill"[documented] -"/api/routine/cook/list"[documented] -"/api/routine/cook/schedule/list"[documented] -"/api/routine/cook/schedule/set"[documented] -"/api/routine/cook/start"[documented] +"/api/recipe/kill"[documented] +"/api/recipe/list"[documented] +"/api/recipe/schedule/add"[documented] +"/api/recipe/schedule/delete"[documented] +"/api/recipe/schedule/list"[documented] +"/api/recipe/start"[documented] "/api/sensor/temperature"[documented] -"/api/settings/cook/recipe/list"[documented] -"/api/settings/cook/recipe/set"[documented] +"/api/settings/recipe/set"[documented] "/api/settings/lighting/list"[documented] "/api/settings/lighting/set"[documented] "/api/settings/time/set"[documented] +"All Kill"[documented] "Heat"[documented] "Lighting Change"[documented] "Lighting Kill"[documented] diff --git a/static/images/rice/connections.svg b/static/images/rice/connections.svg index 53de7d4..d4e9dee 100644 --- a/static/images/rice/connections.svg +++ b/static/images/rice/connections.svg @@ -4,384 +4,351 @@ - - + + %3 - + cluster_key - -Key + +Key cluster_doc - + cluster_sub - + cluster_directives - -Directives + +Directives cluster_primary - -Primary + +Primary cluster_secondary - -Secondary + +Secondary -cluster_sensor - -Sensors +cluster_directives_lighting + +Lighting -cluster_api - -api +cluster_directives_temperature + +Temperature -cluster_action - -action +cluster_sensor + +Sensors -cluster_light - -light +cluster_api + +api -cluster_temperature - -temperature +cluster_api_sensor + +sensor -cluster_api_sensor - -sensor +cluster_recipe + +recipe -cluster_routine - -routine +cluster_schedule + +schedule -cluster_routine_cook - -cook +cluster_settings + +settings -cluster_schedule - -schedule +cluster_time + +time -cluster_settings - -settings +cluster_lighting + +lighting -cluster_time - -time - - -cluster_lighting - -lighting - - -cluster_settings_cook - -cook - - -cluster_recipe - -recipe +cluster_settings_recipe + +recipe Done - -Done + +Done Documented - -Documented + +Documented Undocumented - -Undocumented + +Undocumented Depend on value - -Depend on value + +Depend on value Node - -Node + +Node Depend on value->Node - - + + Proxy to value - -Proxy to value + +Proxy to value Proxy to value->Node - - + + Depend on function - -Depend on function + +Depend on function Depend on function->Node - - + + Proxy to function - -Proxy to function + +Proxy to function Proxy to function->Node - - + + Sleep - -Sleep + +Sleep Heat - -Heat + +Heat - + -Lighting Change - -Lighting Change +All Kill + +All Kill - + Lighting Kill - -Lighting Kill + +Lighting Kill + + + +All Kill->Lighting Kill + + - + Temperature Kill - -Temperature Kill + +Temperature Kill - - -Temperature Kill->Heat - - + + +All Kill->Temperature Kill + + + + + +Lighting Change + +Lighting Change Temperature Change - -Temperature Change + +Temperature Change - + Temperature Change->Sleep - - + + - + Temperature Change->Heat - - + + - + Temperature - -Temperature + +Temperature - + Temperature Change->Temperature - - + + Temperature Hold - -Temperature Hold + +Temperature Hold - + Temperature Hold->Sleep - - + + - + Temperature Hold->Heat - - + + - -Temperature Hold->Temperature - - - - - -/api/action/light/kill - -kill - - - -/api/action/light/set - -set - - - -/api/action/temperature/kill - -kill - - -/api/action/temperature/kill->Temperature Kill - - +Temperature Hold->Temperature + + - - -/api/action/temperature/kill->Temperature - - - - - -/api/action/temperature/set - -set - - - -/api/action/temperature/set->Temperature Change - - + + +Temperature Kill->Heat + + - + /api/sensor/temperature - -temperature + +temperature - - -/api/routine/cook/list - -list - - - -/api/settings/cook/recipe/list - -list - - + -/api/routine/cook/list->/api/settings/cook/recipe/list - - +/api/sensor/temperature->Temperature + + - + + +/api/recipe/list + +list + + + +/api/recipe/start + +start + + + +/api/recipe/kill + +kill + + + +/api/recipe/kill->All Kill + + + + + +/api/recipe/schedule/add + +add + + -/api/routine/cook/start - -start +/api/recipe/schedule/delete + +delete - + -/api/routine/cook/kill - -kill - - - -/api/routine/cook/schedule/list - -list - - - -/api/routine/cook/schedule/set - -set +/api/recipe/schedule/list + +list - + /api/settings/time/set - -set + +set - + /api/settings/lighting/list - -list + +list - + /api/settings/lighting/set - -set + +set - - -/api/settings/cook/recipe/set - -set + + +/api/settings/recipe/set + +set