Recipe
Recipes are a reusable blocks of Edge Connect language which allow for easier integration of various devices and full solutions.
Recipe
Recipe
Recipe
A recipe will typically consume events and emit
events for a top-level configuration to consume.
To receive all/multiple from a recipe a pipeline's eventType can be
specified as a regular expression (must start with '^' or end with '$')
For example "eventType": "^mysensor\..+"
would receive all events emitted by mysensor
.
For consistency, all the identifiers (filter, action, pipelines, connections, etc) in a recipe
must contain only alphanumeric or '-', '/' characters and start with a lowercase alphanumeric character.
Fields
Name | Type | Description | Required |
---|---|---|---|
description | string | Recipe description string Example: "This recipe handles processing of sensor 9000 data" | No |
emits | map of string to RecipeEvent | Declaration of events that the recipe emits map key is the eventType name (accessed via recipeName.eventTypeName) map value is the metadata for the eventType | No |
exports | map of string to RecipeExport | Recipe export declarations map key is the exported name (accessed via recipe.exportedName) map value is the metadata for the exported item | No |
imports | array | Recipe imports Specify imports required by the recipe. Imports can be recipe names or inline json. Example: [ "[email protected]"] | No |
name | string | Recipe name Example: "mysensor" | Yes |
options | RecipeOptions | No | |
recipe | RecipeDefinition | No | |
variables | map of string to RecipeVariable | Recipe variable declarations map key is the exposed variable name (accessed via recipe.variableName) map value is the metadata for the variable | No |
version | string | Recipe version string Must follow semantic versioning rules Example: "1.2.3" | Yes |
Example
{
"emits": {
"aggregateEvent": {
"description": "aggregated advertisement data",
"testFlow": ""
}
},
"exports": {
"hasCheesyEnding": {
"description": "matcher that matches when the value stored in key 'string' ends in 'cheese'"
}
},
"imports": [
"[email protected]"
],
"name": "myRecipe",
"recipe": {
"filters": {
"aggregator": {
"config": {
"interval": "10s",
"mode": "map"
},
"type": "aggregate"
},
"emitter": {
"config": {
"eventType": "myRecipe.aggregateEvent",
"interval": "10s"
},
"type": "emitEvent"
}
},
"matchers": {
"cheesyEnding": {
"string": ".*cheese$"
}
},
"pipelines": {
"scanner": {
"eventType": [
"advertisement"
],
"filters": [
"aggregator",
"emitter"
]
}
}
},
"variables": {
"aggregationInterval": {
"default": "10s",
"description": "set the aggregation interval for advertisements",
"key": "filters.aggregator.config.interval",
"rules": "",
"type": ""
}
},
"version": "1.0.0"
}
Reference
RecipeBLEOptions
RecipeBLEOptions
Recipes may need access to active bluetooth scanning. This section allows a recipe to request that behavior.
Note that active scanning will reduce the number of available scanning windows. Only use if absolutely necessary.
Referenced By:
RecipeOptions
Fields
Name | Type | Description | Required |
---|---|---|---|
activeScanning | boolean | No |
RecipeDefinition
RecipeDefinition
Definines processing encapsulated by a recipe.
Sets up devicegroups, pipelines, connections, cloud connectors, filters, connection actions, etc.
Referenced By:
Recipe
Fields
Name | Type | Description | Required |
---|---|---|---|
actions | map of string to ConnectionAction | Defines the ConnectionActions that can be used in ConnectionSequences .A map of unique identifier to a ConnectionAction definition.ConnectionActions defined here can be reused in multiple ConnectionSequences . | No |
cloud | Cloud | No | |
connections | map of string to ConnectionSequence | Defines the ConnectionSequences that will handle processing of BLE connections.A map of unique identifier to a ConnectionSequence definition.ConnectionSequences are triggered by a connect filter. | No |
devices | Devices | No | |
eventGenerators | map of string to EventGenerator | Defines the EventGenerators to run.A map of EventGenerator ID's to EventGeneratorConfig | No |
filters | map of string to Filter | Defines the Filters available for use in Pipelines .A map of unique identifier to a definition of a Filter .Filters defined here can be reused in multiple Pipelines . | No |
groups | map of string to DeviceGroup | Defines the DeviceGroups that can be referenced by Pipelines .A map of unique identifier to DeviceGroup definition. | No |
keys | KeystoreConfig | No | |
matchers | Matchers | No | |
metadata | Metadata | No | |
minimumVersion | string | Set the minimum version of edge-connect required to run this configuration Example: "2021.01-01" | No |
pipelines | map of string to Pipeline | Defines the Pipelines of Filters that events will flow through.A map of unique identifier to a Pipeline definition. | No |
RecipeEvent
RecipeEvent
All emitted eventTypes must be declared by the recipe.
Referenced By:
Recipe
Fields
Name | Type | Description | Required |
---|---|---|---|
description | string | Description of the recipe eventType Example: "this is a temperature alarm event" | Yes |
testFlow | string | The id of a flow in the recipe's test that emits this event type. Not required yet but will be. Example: "minewP1DataFromUUID" | No |
Example
{
"description": "description of the emitted event",
"testFlow": ""
}
RecipeExport
RecipeExport
Once exported, the item can be used in the top-level configuration as well as other recipes by recipeName.exportedName.
Any processing unit can be exported (filter, action, pipeline, connection, matcher, devicegroup, etc).
The internal lookup is lazy so if you have a filter named myProcessor and an action named myProcessor,
and try to export myProcessor an error will be thrown.
Referenced By:
Recipe
Fields
Name | Type | Description | Required |
---|---|---|---|
description | string | Description of the exported item Example: "filter for converting temperature from F to C." | Yes |
Example
{
"description": "description of the exported item"
}
RecipeOptions
RecipeOptions
These options provide for advanced configuration of wireless features.
Referenced By:
Recipe
Fields
Name | Type | Description | Required |
---|---|---|---|
ble | RecipeBLEOptions | No | |
wirepas | RecipeWirepasOptions | No |
RecipeVariable
RecipeVariable
Once a RecipeVariable is declared, the value can be set
from the top-level Imports configuration.
Referenced By:
Recipe
Fields
Name | Type | Description | Required |
---|---|---|---|
default | ? | The default value of the variable in the recipe Example: "30" | Yes |
description | string | The description of the variable Example: "this variable sets the BLE connection timeout" | Yes |
key | ? | The path to the values in the recipe, can also give an array of keys Example: "filters.myFilter.config.connectionTimeout" | Yes |
rules | string | The rules for the variable value Example: "1m-24h durations are supported" | Yes |
type | string | The data type of variable value. Valid options are string, number, object, array Example: "string" | Yes |
Example
{
"default": "10s",
"description": "set the aggregation interval for advertisements",
"key": "filters.aggregator.config.interval",
"rules": "",
"type": ""
}
Updated over 1 year ago