Creating a new sensor template
Who can do it: Service provider
Where: Wialon Platform Studio
Sensor templates are reusable detailed configuration of telemetry parameters and formatting rules. They let you save and reuse different configurations, for example, for various device models.
This guide shows how to create a sensor template within the selected device on the Devices page. See how to create a sensor template on the Telemetry setup page.
You can create a new template only within a predefined sensor type.
You can create up to 100 sensor templates in the service provider account. Default sensors also count toward this limit. When you reach the limit, you can’t create new sensor templates or copy the existing ones. To create a new template, delete one of the existing templates.
To create a new template:
-
On the Sensors tab in the device properties, select the necessary sensor type.
-
In the Settings panel, locate the Sensor template field.
-
Click on the Sensor template field and select Create new.

-
In the Sensor name field, enter a descriptive name for your template (for example,
Engine temp while driving). -
(Optional): In the Measurement unit field, set the unit of measurement (for example,
°F). -
For the following sensor types: Acceleration, Door open, Engine temperature, Fuel volume, Load weight, Refrigerator temperature, Seatbelt, Tyre pressure, you can add several parameter expressions using the Add sensor button. For the Engine hours counter and Mileage counter, the Calculation option defines the source of data. For the Fuel volume (calibrated) sensor, select a calibration mode (table or capacity) and enter the source parameter. For details, see Configuring a calibrated fuel volume sensor.
-
In the Formula field, define the formula to calculate the sensor value from the raw data. For example, use the parameter
can.engine.coolant.temperatureto see how much heat the engine is producing. -
In the Validation section, add a validation condition to ensure the accuracy of the data:
- In the Type field, select a condition:
- Parameter exists: The message is used if it contains the parameter, whatever its value.
- Parameter is not null: The message is used if the parameter value isn’t zero. If the value is
0orfalse, has no value, or the message doesn’t contain the parameter, the message doesn’t pass the validation.
- In the Parameter name field, indicate the system name of the parameter. For example,
position.speed. You can click Add validation to add more conditions.
- In the Type field, select a condition:
-
Click Save to save your new sensor template.
The created template allows displaying the engine temperature when the vehicle is moving with the graph. The template is now stored in these settings and can be applied to other devices.
For the Driver identification sensor, a message that doesn’t pass the validation unassigns the drivers in both card slots. For example, if you add the Parameter is true validation for the ignition parameter, the driver is unassigned when the ignition is turned off. For details, see Automatic (sensor-based) assignments.
Configuring multiple parameter expressions for a sensor
You can configure more than one parameter expression for a single sensor template. This option is available for Acceleration, Door open, Engine temperature, Fuel volume, Load weight, Refrigerator temperature, Seatbelt, and Tyre pressure.
To define multiple expressions:
- Enter the formula for the first parameter.
- Click Add sensor below the Formula field to add another parameter. The required Name field appears for each parameter. Fill in the name and formula for each of them.
- Repeat the process for each additional parameter you want to configure. You can add up to 10 parameters for a single sensor template. When you reach the limit, the Add sensor button becomes unavailable.
If you delete the additional parameters and only one remains, the Name field disappears, and the parameter uses the sensor name.
Example: For a Seatbelt sensor, you can configure four distinct parameters to monitor each seat in a vehicle. When you set up the Sensor chip for a device or a driver, all the configured parameter expressions will be displayed as separate chips.
Defining data sources for counters
The Calculation option determines the data source for the Engine hours counter and Mileage counter:
- Enabled: Automatically calculates mileage using GPS data and engine hours based on the activity of the configured ignition sensor.
- Disabled: You can manually select a specific parameter as the data source.
Filling in the “Formula” field
To calculate a sensor value from incoming raw data parameters, you must create an expression in the Formula field.
Use the hints with possible functions for your expression and helper text in the tooltips. As you are entering an expression, click the appropriate function name to autocomplete the field.
The formula field uses a syntax similar to programming expressions, incorporating data parameters, mathematical operators, and built-in functions, including logical operators and conditional functions.
You can create your expression using the methods described below.
- Referencing parameters: Always use the
$prefix when referencing parameter values ,for example,$position.speed, to prevent errors if the parameter is not present in a message. When specifying the parameter name as a string (for example, inexists()), do not use$or#. - Access previous values: Use
previous("parameter.name")for stateful calculations.previous(X)will return the current value of parameterXfrom device telemetry, ornullif the message being registered has a timestamp older than whenXwas last set in telemetry. - Use functions:
round(), Returns the nearest whole number (integer) toX. Standard rounding rules apply (for example,$.5$is rounded up).abs(), Returns the absolute value ofX.if(CONDITION, WHEN-TRUE, WHEN-FALSE): Evaluates condition. If true, returns when-true; otherwise, returns when-false.exists('FIELD-NAME'): Returns true if the specified field exists in the message, false otherwise.hex(), Converts the numeric argumentXinto its hexadecimal string representation.not(X): Inverts the boolean value ofX. If X is zero or false, it returns non-zero/true, and vice versa.isnumber(X): Returns true ifXis a number, false otherwise.isstring(X): Returns true ifXis a string, false otherwise.isboolean(X): Returns true ifXis a boolean, false otherwise.isnull(X): Returns true ifXis null, false otherwise.isjson(X): Returns true ifXis a JSON object or array, false otherwise.
- Use logical and mathematical operators: +, -, *, /, >, <, ==, !=, &&, ||. See the list of operators with descriptions in the Logical expression format section.
Example expression for the Acceleration sensor calculating linear acceleration. We count acceleration in m/s2 if time between messages is more than 0 and less than 15.
if( (timestamp - previous('timestamp')) > 0 && (timestamp - previous('timestamp')) <= 15, (position.speed - previous('position.speed')) / (3.6*(timestamp - previous('timestamp'))), 0 )