Automation Sequence Configuration

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.

Settings

OptionTypeRequiredDescription
key[String]YesA unique slug to identify the trigger. Name will be slugged if key not set.
name[String]NoFriendly display name of the sequence. Useful for UI mainly.
topic[String]NoThe channel the sequence listens on and broadcasts events too. Defaults to mudpi/sequences/[sequence_key]
sequence[Array]NoList of sequence steps to be triggered.

Sequence Settings

OptionTypeRequiredDescription
actions[Array]YesList of actions to be triggered.
delay[Integer]NoNumber of seconds to wait before triggering actions.
duration[Integer]NoNumber of seconds to wait after triggering actions.
thresholds[Array]NoList of thresholds to evaluate before triggering actions.

Step Thresholds

Thresholds are conditions to check trigger values against and determine if the trigger should fire. Here are the threshold configuration options below.

OptionTypeRequiredDescription
comparison[String]YesComparison to run against value. Options: eq, ne, gt, gte, lt, lte
value[Integer]YesValue to run comparison against source.
source[String]YesRedis key to get Value to run comparison against value.
nested_source[String]NoIf 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.