Triggers are a core concept of MudPi. A trigger contains a set of conditions or thresholds that take system readings and activates if the threshold have been met. Typically a state change is the most common cause of a trigger.
Below is a list of currently supported interfaces for triggers.
Interface | Description | |
state | Responds to `StateUpdated` events | Learn More |
sensor | Interacts with sensor data | Learn More |
control | Activates when a control is changed | Learn More |
group | Combines multiple triggers together | Learn More |
toggle | Responds to a toggle change event | Learn More |
cron | Uses a cron string to check current time | Learn More |
If you would like at add support for another trigger interface read the developer docs and submit a PR!
Sensors provide a trigger
action to immediately trigger the actions configured to it. This is intended mainly for testing only.
Action | |
trigger | Immediately fire actions on a trigger (TESTING ONLY). |
While you can listen to the StateUpdated
event for all the triggers they also broadcast an event on the trigger
topic as well. This event is broadcast for you to hook into triggers and chain additional functionality.
Event: TriggerFired
{
"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"
}