Context Variables (Rule Engine)
Context Variables are variables that only exist during the execution of a rule and can provide additional context about the rule or event which triggered the rule. For example, if a rule was triggered by a device, context variables are set which include details about the device name, attribute, value, and other helpful details of the event that triggered the rule.
Context Variable Structure
- Event - these are variables that provide context about the event that triggered the rule to start running.
- Metadata - this provides information about the rule itself.
- Rule Name ($context.event.ruleName) - the name of the rule defined by the user.
- Rule ID ($context.event.ruleId) - the rule ID created by the system and can be found in the final part of the URL when editing a rule.
- location - rule was triggered by a Location event
- device - rule was triggered by a Device event
- variable - rule was triggered by a SharpTools Variable event
- dashboard - rule was run directly from a SharpTools dashboard via Rule Tile
- timer - rule was triggered by a timer (eg. recurring time, sunrise, sunset)