Variable Introduction and Overview
Variables are a way to store custom values that can be used in both the SharpTools.io Rule Engine and Dashboards. A variable's value can be modified by using a Variable Tile in the dashboard or using the 'Set Variable' action in an automation rule and can be accessed across dashboards and/or rules as the value is persistent across the SharpTools.io platform.
What can I do with variables?
- Aggregate the status of multiple devices into a single summary for display in the dashboard
ex: status of multiple water sensors, motion status within a whole floor
- Sync attribute value across multiple devices
ex: turn multiple lights on/off, dim multiple lights to the same level, and set multiple ACs to the same cooling point.
- Store a device's attribute value
ex: resume the speaker's volume level or light's dim level
- Store a threshold that can be easily adjusted and used in rule conditions
ex: dynamically change temperature threshold for heater/AC
Supported variable types
- Text: Stores string values
- True / False: Stores a boolean value of true or false
- Number: Stores numeric values (integer and decimal)
How to create variables?
Use Variables in Rule Engine
- When a variable changes and meets the condition specified in the trigger
- Note: Variable triggers can be compared to a static value or to another variable
- For example, if variable $hasAnyLeak value changes and the value is True.
- For example, when the Thermostat's temperature changes, and the temperature value is greater than variable $numTemperature's value
- Using variables in IF_Condition is similar to using Variables in the Trigger.
- A variable can be compared to a static value or another variable.
- A location/device's attribute value can be compared to a variable's value.
- Device Command
- A variable can be used as an parameter when sending a command to a device.
For example, set speaker's level (volume) by using the $intVolume variable's value
(Tap the icon next to the argument input field to change between Manual Input or Variable Selector)
- Set Variable
- There are four types of value sources that can be used when setting a variable's value. The available source type options depend on the selected variable data type (Text, Number, True/False).
- Manual Input: set variable to a static value, such as True, 50, or "On". (The value input options depend on the variable data type.)
- Device Attribute: set a variable using a device attribute's value.
Ex: set a N umber variable's value using a light's dim level, or set a Text variable's value using a door's contact state.
- Location Attribute: set a variable using a location attribute's value.
Ex: set a Text variable's value using the SHM/HSM or Mode state.
- Variable: set the variable value using another variable's value
Use Variables in Dashboard