|  Help center

MiOS search

Variables

Overview

A variable is a user-created container used to house a specific piece of data. You can use variables in meshbot triggers on devices which have capabilities which may be at a range of levels. There are a variety of different variable types which you can use, including ‘Integer’, ‘Boolean’, ‘Scaleable’ and more:

  • For example, you might create an ‘Integer’ variable named ‘Battery Warning Level’ to notify you if a device’s battery drops below 10%. You could use the same variable in triggers for any device that has batteries:
  • … or create a ‘Turn On AC’ integer variable with ‘18’ as its value, then create a trigger which turns on your air conditioning if it detects a temperature higher than this variable
  • You can use a single variable in as many different meshbots as you want. If you update the variable’s value then it also gets updated in all triggers which feature the variable. For example, you could create ‘scalable’ illuminance variables and use them in triggers for multiple different lamps:
Integer

‘Integer’ is a simple variable that lets you define a number as its value. The number has no set scale so you can use it to reference different scales depending on the device in your trigger. For example, you can use it to represent a percentage, light dimmer level, temperature, power level, humidity level and more.

The following example shows an integer variable named ‘Twenty percent capacity’ with a corresponding value of ‘20’:

You could use this same variable in multiple triggers. For example, here it is being used as a condition in two different triggers – one for a light’s dimmer level and the other for a smoke detector’s battery level:

…of course, the example above will only work on device capabilities which have a scale range of 0-100.

String

The ‘string’ variable lets you create a variable with letters and/or special characters + numbers as its value.

You can create string values which are:

  • Blank.
  • All letters or all special characters.
  • Any combination of letters, special characters and numbers.
  • But you cannot create a string value which is only numbers.
Boolean

‘Boolean’ variables are variables with a binary ‘True’ or ‘False’ value. You can use this type of variable on any device which features true and false (or ‘on/off’) states. For example, switches, lightbulbs, televisions etc. This is especially useful for capabilities that support boolean values, but don’t have them in their native settings.

Color

The ‘Color’ variable lets you set a hex value which corresponds to a specific color. You can select a color by directly entering a hex into the ‘Variable Value’ field, or by clicking the color icon then choosing from the color picker:

You can also use the sample tool to choose any color on your desktop:

You can then use the variable in triggers for devices which allow you to choose color values:

Token

‘Token’ variables are used to present multiple choices to users in radio buttons or drop-down lists. Use the checkboxes to choose the ‘current’ key-value pair.

Scalable

‘Scalable’ variables let you use a device value of a specific scale in your meshbot triggers.

  • There are 37 different types of scaleable value that you can choose. These include ‘Temperature’, ‘Frequency’, ‘Angle’, ‘Length’, ‘Illuminance’, ‘Loudness’ and more.
  • Many types let you choose from multiple units of measurement. For example, the temperature scaleable lets you specify a value in fahrenheit or celsius. The ‘Mass’ scaleable lets you choose between kilograms or pounds.
  • The ‘Temperature’ scalable is unique in that it automatically converts the value to match the scale used on your target device. For example:

    • You create a ‘Temperature’ variable with a value of ‘32’ and scale = ‘Fahrenheit’.
    • You use that variable in a trigger with a device that uses celsius.
    • EZLogic converts the celsius reading from the device to the fahrenheit scale of the variable (‘0’ to ‘32’), so the trigger still works.
  • For all other types of scalable, you must make sure your unit of measurement matches the units on your target device.

Here are a few examples of scalable variables you could create:

‘Save Output’ feature

The ‘save output’ feature lets you create or update a variable value with the response from a http request or NuCAL service. The following example shows how a variable could store the response from a http request for carbon data:

You can then create a Lua script to extract specific values from the output for use in a trigger.