Goal
Run a condition Function before a Trigger runs, and only execute the handler Function when the condition passes.Steps
1. Register the handler and condition Functions
Register a normal handler Function and a condition Function that returnstrue or false.
Both Functions are declared in the same way. They only differ in how they are used.
- Node / TypeScript
- Python
- Rust
conditions-functions.ts
2. Register triggers with the correct condition key
Create a Trigger and specify its condition withcondition_function_id.
Example (state trigger):
- Node / TypeScript
- Python
- Rust
state-trigger-with-condition.ts