Synthetic variables editor

Ubidots Synthetic Variables Editor is a simple and effective way to write and configure the synthetic expression that will be computed.

In the bottom right corner of the editor, you will see a message that indicates if the expression is valid and can be computed, or if there is an issue with the syntax that will need to be corrected.


The synthetic variables editor allows selecting a timezone to reference the exact variable's timestamps based on a particular place. This comes in handy when is needed to calculate a variable for a client, user, or process that has a different timezone than the one you are located at.


Synthetic Variables allows context data handling, meaning you can take the context of the raw variable and use it in the synthetic expression but only if the context value is a number. Accessing it from the Synthetic editor is straightforward, you just need to use the dot . operator over the variable, add context and then the context key identifier:



Similarly to accessing context data, timestamp can be accessed in Synthetic Variables using the dot . operator.


Device properties

It is possible to use device properties in a synthetic variable expression as long as the property has a floating number format. To access it from the synthetic editor it is necessary to use any of the following syntax to retrieve the device object:

Using a device's id


Using a device's label


Then, in order to access this device's properties, you need to use the dot operator . as:


Here, you need to replace <device> with the id or label of the device that you wish to calculate the synthetic variable for.

Now, you can retrieve any of the device's properties using the property's key as:


Where <key> is the property's key. For example, suppose that you need to retrieve property uptime from a device whose id is 65fb47fad809281764f8a350 then, the following syntax accomplishes just that:


Note that in order to use the properties of the device in a synthetic variable, it is necessary to have a mathematical expression with another variable, which will determine the calculation of new data within the synthetic variable.

Using device properties from device types synthetic variables editor

It is also possible to create a synthetic variable across device types from within the synthetic variables editor at device types module using any of the following syntax:


Here, you should only replace the property's key for the intended value. The keyword self is a placeholder that gets replaced by the actual device id for all the devices contained in this device type

Last updated