An automation sequence contains a list of actions to be performed in order with a delay in between each step. This delay can be set by duration
in seconds. If no duration is provided the step will wait indefinitely for another update from a trigger or a SequenceNextStep
event is received. Sequences help build on basic actions and allow your to build complex automations with MudPi. You can read more about the concepts of automation sequences here.
Below is an example of a sequence configuration.
"sequences": [
{
"name":"Example Watering Sequence",
"key": "example_sequence",
"sequence": [
{
"actions": ["turn_on_pump", "turn_on_valve_1"],
"duration": 10
},
{
"actions": ["turn_off_valve_1", "turn_on_valve_2"],
"duration": 10
},
{
"actions": ["turn_off_valve_2", "turn_on_valve_3"],
"duration": 10,
"thresholds": [
{
"source": "dht",
"nested_source":"temperature",
"comparison":"gte",
"value":70
}
]
},
{
"actions": ["turn_off_valve_2", "turn_off_valve_3", "turn_on_valve_4"]
},
{
"actions": ["turn_off_valve_4"],
"duration": 0
}
] }
]
The configuration above will create an action sequence that has 5 steps. Each step has a list of actions that it performs. If a delay
is set then the actions performed after the delay is complete. Once the actions are performed then if a duration
is set the sequence will wait until the duration is complete and then proceed to the next step.
Option | Type | Required | Description |
key | [String] | Yes | A unique slug to identify the trigger. Name will be slugged if key not set. |
name | [String] | No | Friendly display name of the sequence. Useful for UI mainly. |
topic | [String] | No | The channel the sequence listens on and broadcasts events too. Defaults to mudpi/sequences/[sequence_key] |
sequence | [Array] | No | List of sequence steps to be triggered. |
Option | Type | Required | Description |
actions | [Array] | Yes | List of actions to be triggered. |
delay | [Integer] | No | Number of seconds to wait before triggering actions. |
duration | [Integer] | No | Number of seconds to wait after triggering actions. |
thresholds | [Array] | No | List of thresholds to evaluate before triggering actions. |
Thresholds are conditions to check trigger values against and determine if the trigger should fire. Here are the threshold configuration options below.
Option | Type | Required | Description |
comparison | [String] | Yes | Comparison to run against value. Options: eq , ne , gt , gte , lt , lte |
value | [Integer] | Yes | Value to run comparison against source. |
source | [String] | Yes | Redis key to get Value to run comparison against value. |
nested_source | [String] | No | If source contains a dict then the nested_source is used as the key to find the value from that dict. |
Learn more about using automation sequences under the automation sequence docs.