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.
Option | Type | Required | Description |
type | [String] | Yes | Type of action. Options: event , command |
key | [String] | Yes | A unique slug to identify the action. This is used in trigger configuration. |
name | [String] | No | Friendly display name of the action. Useful for UI. |
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.
Option | Type | Required | Description |
action | [Object] | Yes | Event object that will be emitted. |
topic | [String] | Yes | Channel to emit the event on. |
Option | Type | Required | Description |
action | [String] | Yes | Command string or file path to be executed. |
shell | [Boolean] | No | Setting 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.