Things5 platform syncs all recipes available on the device once. So that when a user on things5 needs to get a recipe can do so even if the device is offline.
To do so things5 sends both a Read recipes request and a List recipes request.
If your hardware has very limited hardware resources and cannot send all recipes at once subscribe to list recipes request and ignore read recipes request. Things5 will send a separate Read recipe request for each recipe id provided.
Choose this method also if there are a lot of recipes since the mqtt payload cannot be over 128KB
Otherwise subscribe to Read recipes request and send all device recipes as a response.
When the user creates/edits a recipe things5 sends a write recipe request This request is expected to write the edited/new recipe on the device without touching the other recipes on the device.
NOTE: to support legacy apis things5 also sends a write recipes request when creating/editing a recipe. Please ignore it.
There are 11 topics:
Subscribe
-
[Sub] Read recipes request: listen for read recipe requests
-
[Sub] Read recipe request: listen for read recipe request
-
[Sub] List recipes request: listen for list recipe requests
-
[Sub] Write recipe request: listen for write recipe requests
-
[Sub] Delete recipe request : listen for delete recipe requests
Publish
- [Pub] Read recipes response: publish requested device recipes
- [Pub] Read recipe response: publish requested device recipe
- [Pub] List recipes response: publish requested device recipes ids
- [Pub] Write recipe response: publish written device recipe
- [Pub] Delete recipe response: publish delete machine recipe success/errors
- [Pub] Recipes updated manually: publish on this topic to notify that recipes have been manually updated on a machine
Recipe structure
name | type | description | example |
---|---|---|---|
id | string | recipe id. Can be any unique string. If present update the recipe, otherwise create a new recipe | "83412jnjasdlfnha1234" |
can_be_edited | boolean | ||
can_be_deleted | boolean | ||
name | string | recipe name | "Pollo con patate" |
description | string | recipe description | |
index | integer | the recipe index starting from 0. Can be used by device to order the recipes. | |
phases | objects array | an array of objects with a values property that lists each variable name, value and type. Values type can be integer, float, string, boolean. Dosages is optional. dosages type can be integer or float | [ { "values": [ { "name": "tim", "value": "5", "type": "integer" }, { "name": "wrk", "value": "PREPARATION", "type": "string" }, { "name": "s1", "value": "0", "type": "integer" }, { "name": "s2", "value": "0", "type": "integer" }, { "name": "tmp", "value": "0", "type": "integer" } ], "dosages": [ { "name": "2", "unit": "g", "quantity": "10000", "type": "integer", "metadata": [{ "name": "wait", "value": "0", "type": "integer" }] } ] }, { "values": [ { "name": "tim", "value": "480", "type": "integer" }, { "name": "wrk", "value": "V1", "type": "string" }, { "name": "s1", "value": "0", "type": "integer" }, { "name": "s2", "value": "0", "type": "integer" }, { "name": "tmp", "value": "0", "type": "integer" } ], "dosages": [] } ] |
metadata | object | Custom attributes. Type can be integer, float, string, boolean | [ { "name": "max_t", "value": "0", "type": "integer" }, { "name": "weight", "value": "16830", "type": "integer" }, { "name": "pieces", "value": "48", "type": "integer" } ] |