Documentation

Trigger Configuration

Configure triggers that activate actions when sensor readings or component states meet defined thresholds.

Overview

Triggers are a core concept of MudPi. A trigger contains a set of conditions or thresholds that evaluate system readings and activates when the thresholds have been met. Typically a state change is the most common cause of a trigger firing.

Available Interfaces

Below is a list of currently supported interfaces for triggers:

Interface Description
`state` Responds to `StateUpdated` events.
`sensor` Interacts with sensor data.
`control` Activates when a control is changed.
`group` Combines multiple triggers together.
`toggle` Responds to a toggle change event.
`cron` Uses a cron string to check current time.

Tip

If you would like to add support for another trigger interface, read the developer docs and submit a PR.

Available Actions

Triggers provide a trigger action to immediately fire configured actions. This is intended mainly for testing:

Action Description
`trigger` Immediately fire actions on a trigger (testing only).

Trigger Event

While you can listen to the StateUpdated event for all triggers, they also broadcast an event on the trigger topic. This event allows you to hook into triggers and chain additional functionality.

TriggerFired Event
{
  "event": "TriggerFired",
  "component_id": "example_trigger_1",
  "name": "Example Trigger 1",
  "updated_at": "2021-03-14 09:34:33",
  "state": 12,
  "source": "example_sensor_1"
}