The state
extension works with the MudPi state manager to offer state based triggers. The state
trigger is the reccomended way to respond to new state from components.
This extension does not take an extension level config and is focused on interfaces.
Provides a trigger that listens for a StateUpdated
event on the state
topic.
Option | Type | Required | Description |
key | [String] | Yes | Unique slug id for the component |
source | [String] | Yes | Component key to check for new state. |
nested_source | [String] | No | If the data is an object this is the key from that object to fetch. |
frequency | [String] | No | Number of times to trigger actions once trigger is active. Options: once , many . Default: once |
thresholds | [Array] | No | Array of threshold configuration objects to evaluate the reading data to. |
name | [String] | No | Friendly display name of component. Useful for UI. |
actions | [List] | No | List of registered actions to fire. |
Here is a config of a complete trigger.
"trigger": [{
"key": "temperature_trigger",
"interface": "state",
"source": "dht_1",
"nested_source":"temperature",
"name": "Temperature too Hot",
"frequency":"many",
"thresholds": [
{
"comparison":"gte",
"value":74
}
],
"actions": ["toggle.turn_on"]
}]
The configuration above would turn_on
all toggles if the temperature was above 74.