Variable Introduction and Overview

Variables are a powerful tool that let you store and use custom values in both your Dashboards and Rule Engine. Acting like containers that hold data, variables allow you to gather information from multiple devices, coordinate actions across them, remember settings, or easily adjust rules.

You can create variables to meet your needs! In the example, we have a variable to aggregate status of a group of devices, a True/False to enable or disable Rule Execution, and a Shared Volume Level

This feature, exclusive to our Premium users, enables you to fine-tune your smart home setup, making automation rules and dashboards more flexible and personalized. Whether dealing with numbers, true/false conditions, or text, variables provide an extra layer of adaptability that simplifies and enhances your interaction with your smart devices on the SharpTools.io platform.

Variables are a Premium only feature, and can be accessed during your Premium trial period. If you are using the free tier, please send us an email to support@sharptools.io if you'd like us to reset your trial to give Variables a try.

What can I do with variables?

Variables can creatively supplement both Dashboards and the Rule Engine. Here are a few popular applications of variables:

  1. Consolidate several devices' status into a singular summary for display on the dashboard

    For example: combining the status of numerous water sensors or motion statuses within an entire floor.

  2. Synchronize attribute values across several devices

    For example: synchronizing on/off commands for multiple lights, dimming numerous lights to the same intensity, or setting several air conditioners to the same cooling level.

  3. Store a device's attribute value

    For example: retaining the volume level of a speaker or light's dimming level.

  4. Save an easily adjustable threshold for use in rule conditions

    For example: adjusting the temperature threshold for a heater/AC dynamically.

Supported variable types

  1. Text: Stores string values
  2. True / False: Stores a boolean value of true or false
  3. Number: Stores numeric values (integer and decimal)

How to create variables?

The Manage Variables screen can be accessed from Manage Resources, Manage Rules, and the Rule Editor. All the previously created variables can be found here along with their current values. To create a new variable, tap "Create Variable" button at the bottom-right corner.

The variable name must by unique across your account and only alpha-numeric characters are permitted. The name must not contain spaces, underscores (_), dashes (-), dots (.), or other symbols. Once created, the variable name can't be altered. We suggest choosing a straightforward and self-explanatory variable name to avoid potential confusion. After creating the variable, you can revisit the Manage Variables screen to update its value or delete it at any time.

Caution: Deleting a variable could disrupt your existing automation rules or dashboards that utilize the variable.

Use Variables in Rule Engine

Triggers

Variables can be incorporated into the rule trigger in two ways:

  1. When a variable changes and meets the condition specified in the trigger
    • Note: Variable triggers can be compared to a static value or another variable
    • For example, if the value of variable $hasAnyLeak changes and becomes True.

  2. When the value of a location or device attribute changes and meets a trigger condition that compares the attribute value to a variable value
    • For example, when the Thermostat's temperature changes, and the temperature value exceeds variable $numTemperature's value

You can switch the value input field between Manual Input or Variable Selector by tapping the icon next to the input field.

Flow

Variables can be incorporated into IF_Condition, Device Command, or Set Variable in the rule Flow section:

  1. IF_Condition

    The usage of variables in IF_Condition mirrors that in the Trigger.

    1. A variable can be compared to a static value or another variable.
    2. An attribute value of a location/device can be compared to a variable's value.
  2. Device Command

    A variable can be utilized as a parameter when sending a command to a device.

    • For example, you can set the speaker's volume level using the value of the $intVolume variable.

      You can switch the value input field between Manual Input or Variable Selector by tapping the icon next to the input field.
  3. Set Variable

    There are five types of value sources available when setting a variable's value. The options depend on the chosen variable data type (Text, Number, True/False).

    1. Manual Input: Set the variable to a static value, like True, 50, or "On".

      (The value input options depend on the variable data type.)

    2. Device Attribute: Assign a variable's value using a device attribute's value.

      Ex: Set a Number variable's value using a light's dim level, or a Text variable's value using a door's contact state.

    3. Location Attribute: Assign a variable's value using a location attribute's value.

      Ex: Set a Text variable's value using the SHM/HSM or Mode state.

    4. Variable: Set the variable value using another variable's value
    5. Expression: Evaluate a logical or math expression and set the variable to the resulting value of the expression


Use Variables in Dashboard

Variables can be added to the dashboard through the Add Item list while editing the dashboard. The current value of the variable can be viewed or altered through the added variable tiles. Common tile settings like 'Security' can also be applied to variable tiles, for instance, to make a variable read-only.

By default, the Variable Tile displays an input prompt (toggle for True/False variable) when tapped in the dashboard to allow value updates. You can customize the tile to a open hyperlink when the tile is tapped: such as a website, another dashboard, or execute a rule by using the special Hyperlink syntax. This flexibility allows you to achieve a variety of different creative actions.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.