Action Configuration

Actions are a response to a trigger. Actions are either events or commands that get run when a trigger's thresholds are met. You can read more about the concepts of actions here.

Below is an example of an action configuration.

{
    "actions": [{
            "type": "event",
            "name": "Turn on Lights",
            "key": "turn_on_lights_1",
            "action": {"event":"Toggle"},
            "topic": "garden/pi/relays/2"
        }]
}

The configuration above will send a Toggle event on the topic garden/pi/relays/2 which would turn on/off lights hooked up to the relay in this example.

Settings

OptionTypeRequiredDescription
type[String]YesType of action. Options: event, command
key[String]YesA unique slug to identify the action. This is used in trigger configuration.
name[String]NoFriendly display name of the action. Useful for UI.

Event Action Specific Settings

Event actions will emit an event that you set in the action option and on the channel you set in the topic. Try emitting a "Switch" or "Toggle" event to a topic a relay is set to.

OptionTypeRequiredDescription
action[Object]YesEvent object that will be emitted.
topic[String]YesChannel to emit the event on.

Command Action Specific Settings

OptionTypeRequiredDescription
action[String]YesCommand string or file path to be executed.
shell[Boolean]NoSetting to expand full shell to execute command. Must be True if command is not a file. Default: False

Learn more about actions under the action docs.