Rules are always run based on Triggers which are instantaneous events like a device changing state or time ticking over to a particular time.
As shown in the screenshot above, Triggers can either be Event based or Time based - either way, those are instantaneous events that cause the trigger to be evaluated. If the trigger condition is met, the rule is run.
Note that Event Triggers are always OR’ed together. Meaning that when any of the triggers become active, the rule will be run.
Event Triggers
Event based triggers include the following options:
As you might infer from the name, these type of triggers occur based on events in the home. With events being the instantaneous moment that the state of the thing, mode, or alarm status changes to meet the specified condition. (This is different than If Conditions that we’ll talk about later that are based on checking what the current state is)
- Device
- When you select a Device based trigger, you’ll then be prompted to select the Device, Attribute, Operator, and Value.
- These are evaluated anytime an event is reported from your hub to SharpTools
- For most devices, this is anytime the attribute value changes - whether that Thing’s attributes update only based on events from the physical device or whether it polls the physical device for changes
- These are triggered as soon as the attribute state changes to meet the condition you specify
- For Example:
- ‘Motion is active’ - as soon as the motion changes from inactive to active, the rule is triggered
- ‘Temperature > 70’ - each time the temperature changes, the trigger is evaluated and if it’s above 70, the rule will then run. eg. 69=false → 70=false → 71=true → 72=true → 71=true → 70=false; So each time the temperature is reported and it’s above
- Also keep in mind that you can set up two triggers for an attribute with exactly opposite conditions to trigger anytime the Thing’s attribute state changes
- For example, setting up triggers with ‘Motion is active’ and ‘Motion is not active’ will cause the rule to trigger anytime the motion status changes
- You typically will want to use this along with a condition inside the flow
- Routine
- These are triggered whenever a SmartThings Classic ‘Routine’ is executed.
- As soon as the selected routine is executed, an event is sent to SharpTools and this is considered triggered
- Mode
- Whenever the SmartThings or Hubitat location’s mode changes to your desired mode, this will trigger.
- SHM - Smart Home Monitor (SmartThings Classic)
- Whenever the Smart Home Monitor state changes to your desired status, this will trigger
- HSM - Hubitat Safety Monitor (Hubitat)
- Whenever the Hubitat Safety Monitor state changes to your desired status, this will trigger
Time Triggers
Similar to Event triggers, Time Schedule triggers are instantaneous events that trigger a rule.
When the time ticks over to your configured time schedule, the rule will run.
- Timer
- When the time changes to the specific time, run the rule
- Also has options for repeating on a daily basis, only on certain days, or one time (‘none’ repetition setting)
- Note that these require that your approximate geo coordinates are set for your location, so the system can figure out your timezone.
- Sunrise
- When sunrise occurs at your location, run the rule
- You can optionally specify an offset before or after sunrise - for example, 30 minutes before sunrise
- Note that these require that your approximate geo coordinates are set for your location, so the system can determine the sunrise and sunset for your location
- Sunset
- When sunset occurs at your location, run the rule
- You can optionally specify an offset before or after sunset - for example, 30 minutes before sunset
- Note that these require that your approximate geo coordinates are set for your location, so the system can determine the sunrise and sunset for your location
Once a rule is triggered, the Flow is evaluated / executed.
So back to your specific questions:
-
Motion sensor - fires immediately on activity
The trigger condition is evaluated anytime the attribute value changes and if the trigger condition is met, the rule is triggered and run.Keep in mind that some motion sensors have multiple attributes, so if you have something like ‘Kitchen Motion Sensor - motion is active’ as the trigger, the trigger will only be evaluated when the motion attribute changes and will only trigger the rule to run when the value specifically changes to ‘active’
-
Open\Close sensor, button or switch - fires immediately the state changes
Same comments as motion sensor. -
Temperature Sensor - Does the rule fire each time the temp sensor reports the temperature (5 minutes). Or does it report every 5 minutes AND whenever the temperature value changes.
The trigger is evaluated each time the temperature sensor changes and triggers the rule every time if the condition is met. (See example in ‘Devices’ above) -
Do the same rules governing temp sensors apply to thermostat.
Yes, anytime the attributes of a thermostat changes, the trigger is evaluated and if the trigger condition is met, the rule is triggered and run. -
Smart Weather Station - Do rules fire when a particular data point changes or are these polled at a predetermined frequency?
The trigger is evaluated anytime the device reports an event and the rule is run if the trigger conditions are met.There is no periodic polling done from the rules at all - it’s always event driven based on the events that the device driver reports.
-
What about a Rule where the Event Trigger is always True. For example a motion sensor that is always Inactive (in a drawer or dead battery) or a thermostat temperature that is less than 100. Do they fire every second, every minute, every 5 minutes?
They fire one time when the event is received. So if the motion sensor was already ‘inactive’ in the drawer when the rule is setup, the rule will not trigger until the motion sensor becomes inactive.