Virtual sensors are properties on a tracker that can be defined by the user. You can configure these properties as a formula. These properties will then be visible in FleetManagement on the real-time state view but also can be configured to be included in a trigger configuration.
Configuring a Virtual Sensor:
As per the screenshot below, to configure a Virtual Sensor, you need to go to the settings page of the tracker. In this example there are 3 virtual sensors configured. Under the Sensor section, you can define the name of your Virtual Sensor. In the configuration you can enter the formula, the format and properties will be documented below. Finally under Output, you can select the optional output type. This is required to include a Virtual sensor in a Trigger configuration, because the Virtual Sensor will be matched based on this option.
Defining a Virtual Sensor formula:
The formula you can add in the configuration for a Virtual Sensor needs to abide by several rules and includes several operators and input variables.
The first and foremost rule is that the outcome of the formula needs to be interpretable as a Boolean. This means the formula must result in either a True / False or 1 / 0 outcome. The following operators are available:
Operator | Description |
&& | Logical AND (condition A and condition B have to be true) |
|| | Logical OR (condition A or condition B has to be true) |
== | Equals (value on the left has to match the value on the right) |
!= | Not Equals (value on the left has to be different from the value on the right) |
> | Greater Than (value on the left has to be greater than the value on the right) |
< | Lesser Than (value on the left has to be smaller than the value on the right) |
>= | Greater or Equal to (value on the left has to be greater or equal to the value on the right) |
<= | Less or Equal to (value on the left has to be smaller or equal to the value on the right) |
In this formula the DeviceState (meaning the properties of the current device state) object is used as input. You can use any of the properties described below in this formula:
Property Name | Property Description |
CurrentPosition.Latitude | The latitude of the current position |
CurrentPosition.Longitude | The longitude of the current position |
CurrentPosition.UpdateTimestamp | The timestamp for the current position data |
CurrentPosition.Speed | The speed at the current position |
CurrentPosition.Heading | The heading (direction) at the current position |
CurrentPosition.Altitude | The altitude at the current position |
CurrentPosition.RadiusInMeters | The radius (uncertainty) of the current position in meters |
CurrentPosition.Hdop | The horizontal dilution of precision for the current position |
CurrentPosition.Vdop | The vertical dilution of precision for the current position |
CurrentPosition.Pdop | The positional dilution of precision for the current position |
CurrentPosition.Satelllites | The number of satellites used to determine the current position |
Odometer.GpsOdometer | The odometer reading based on GPS data |
Odometer.CanBusOdometer | The odometer reading from the CAN bus |
Odometer.UpdateTimestamp | The timestamp for the odometer data |
Temperature1.TemperatureInCelcius | The temperature in degrees Celsius for temperature sensor 1 |
Temperature1.UpdateTimestamp | The timestamp for the temperature data from sensor 1 |
Temperature2.TemperatureInCelcius | The temperature in degrees Celsius for temperature sensor 2 |
Temperature2.UpdateTimestamp | The timestamp for the temperature data from sensor 2 |
Temperature3.TemperatureInCelcius | The temperature in degrees Celsius for temperature sensor 3 |
Temperature3.UpdateTimestamp | The timestamp for the temperature data from sensor 3 |
Temperature4.TemperatureInCelcius | The temperature in degrees Celsius for temperature sensor 4 |
Temperature4.UpdateTimestamp | The timestamp for the temperature data from sensor 4 |
Humidity1.HumidityInPercent | The humidity in percent for humidity sensor 1 |
Humidity1.UpdateTimestamp | The timestamp for the humidity data from sensor 1 |
Humidity2.HumidityInPercent | The humidity in percent for humidity sensor 2 |
Humidity2.UpdateTimestamp | The timestamp for the humidity data from sensor 2 |
TotalAxleWeight.TotalWeightInKg | The total weight in kilograms for all the axles |
TotalAxleWeight.UpdateTimestamp | The timestamp for the total axle weight data |
TotalAxleWeight.AverageWeightInKg | The average weight in kilograms per axle |
Fuel.FuelLevelInPercentage | The fuel level in percentage |
Fuel.FuelLevelRaw | The raw fuel level data |
Fuel.UpdateTimestamp | The timestamp for the fuel data |
Fuel1.FuelLevelInPercentage | The fuel level in percentage |
Fuel1.FuelLevelRaw | The raw fuel level data |
Fuel1.UpdateTimestamp | The timestamp for the fuel data |
Fuel2.FuelLevelInPercentage | The fuel level in percentage |
Fuel2.FuelLevelRaw | The raw fuel level data |
Fuel2.UpdateTimestamp | The timestamp for the fuel data |
Ignition.State | The current state of the ignition |
Ignition.UpdateTimestamp | The timestamp for the ignition data |
ExternalPower.State | The current state of the external power |
ExternalPower.UpdateTimestamp | The timestamp for the external power data |
Input1.State | The current state of input 1 |
Input1.UpdateTimestamp | The timestamp for the input 1 data |
Input2.State | The current state of input 2 |
Input2.UpdateTimestamp | The timestamp for the input 2 data |
Input3.State | The current state of input 3 |
Input3.UpdateTimestamp | The timestamp for the input 3 data |
Input4.State | The current state of input 4 |
Input4.UpdateTimestamp | The timestamp for the input 4 data |
Input5.State | The current state of input 5 |
Input5.UpdateTimestamp | The timestamp for the input 5 data |
Input6.State | The current state of input 6 |
Input6.UpdateTimestamp | The timestamp for the input 6 data |
Output1.State | The current state of output 1 |
Output1.UpdateTimestamp | The timestamp for the output 1 data |
Output2.State | The current state of output 2 |
Output2.UpdateTimestamp | The timestamp for the output 2 data |
Output3.State | The current state of output 3 |
Output3.UpdateTimestamp | The timestamp for the output 3 data |
Output4.State | The current state of output 4 |
Output4.UpdateTimestamp | The timestamp for the output 4 data |
Analog1.Value | The value of analog input 1 |
Analog1.UpdateTimestamp | The timestamp for the analog input 1 data |
Analog2.Value | The value of analog input 2 |
Analog2.UpdateTimestamp | The timestamp for the analog input 2 data |
ExternalBattery.BatteryLevelInVoltage | The battery level in voltage for the external battery |
ExternalBattery.UpdateTimestamp | The timestamp for the external battery data |
BackupBattery.BatteryLevelInVoltage | The battery level in voltage for the backup battery |
BackupBattery.UpdateTimestamp | The timestamp for the backup battery data |
CommunicationStatus.LocationType | The type of location |
CommunicationStatus.EventType | The type of event |
CommunicationStatus.MessageSequenceNumber | The message sequence number |
CommunicationStatus.UpdateTimestamp | The timestamp for when the data was updated |
CommunicationStatus.ServerTimestamp | The timestamp for when the data was received by the server |
CommunicationStatus.IsRoaming | Indicates whether the device is roaming |
DriverIdTagStatus.Tag | The tag value |
DriverIdTagStatus.UpdateTimestamp | The timestamp for when the data was updated |
TagScanStatus.Tag | The tag value |
TagScanStatus.UpdateTimestamp | The timestamp for when the data was updated |
RpmStatus.Rpm | The RPM value |
RpmStatus.UpdateTimestamp | The timestamp for when the data was updated |
DeviceActivityStatus.DlpDeviceState | The device state |
DeviceActivityStatus.UpdateTimestamp | The timestamp for when the data was updated |
BatteryConsumptionState.BatteryChargeState | Indicates whether the battery is charging |
BatteryConsumptionState .BatteryChargeLevelInPercentage | The battery charge level in percentage |
BatteryConsumptionState .BatteryPowerConsumptionInKWhPer100Km | The battery power consumption in KWh per 100 km |
BatteryConsumptionState .RemainingDistanceInKm | The remaining distance in km |
BatteryConsumptionState .UpdateTimestamp | The timestamp for when the data was updated |
FuelConsumptionState.FuelConsumed | The amount of fuel consumed |
FuelConsumptionState.RemainingDistanceInKm | The remaining distance in km |
FuelConsumptionState.UpdateTimestamp | The timestamp for when the data was updated |
Angle1.AngleInDegrees | The angle in degrees |
Angle1.UpdateTimestamp | The timestamp for when the data was updated |
Angle2.AngleInDegrees | The angle in degrees |
Angle2.UpdateTimestamp | The timestamp for when the data was updated |
Angle3.AngleInDegrees | The angle in degrees |
Angle3.UpdateTimestamp | The timestamp for when the data was updated |
Angle4.AngleInDegrees | The angle in degrees |
Angle4.UpdateTimestamp | The timestamp for when the data was updated |
BleBatteryState1.BatteryLevelPercentage | The battery level percentage for a bluetooth ble sensor |
BleBatteryState1.UpdateTimestamp | The timestamp for when the data was updated |
BleBatteryState2.BatteryLevelPercentage | The battery level percentage for a bluetooth ble sensor |
BleBatteryState2.UpdateTimestamp | The timestamp for when the data was updated |
BleBatteryState3.BatteryLevelPercentage | The battery level percentage for a bluetooth ble sensor |
BleBatteryState3.UpdateTimestamp | The timestamp for when the data was updated |
BleBatteryState4.BatteryLevelPercentage | The battery level percentage for a bluetooth ble sensor |
BleBatteryState4.UpdateTimestamp | The timestamp for when the data was updated |
AccelerometerState.AccelerationForce | The acceleration force |
AccelerometerState.BrakingForce | The braking force |
AccelerometerState.CorneringForce | The cornering force |
AccelerometerState.UpdateTimestamp | The timestamp for when the data was updated |
Along with these properties you can use certain built in functions to add some more advanced functionality to the formula. One of these examples is DateTime.UtcNow which retrieves the current date and time in UTC. Since all the UpdateTimestamps are also in UTC, this is usefull to compare against. On the DateTime.UtcNow you have the option to add several modifiers to change the date. These modifiers are AddDays(n) with n being the negative or positive amount of days to add, Add Hours(n) with n being the negative or positive amount of hours to add or AddMinutes(n) with n being the negative or positive amount of minutes to add.
An example function using this capability would be:
Ignition.State && (ExternalBattery.UpdateTimestamp >= DateTime.UtcNow.AddDays(-1) ? (ExternalBattery.BatteryLevelInVoltage > 24) : true)
This example would return true when the device has Ignition.State = true but also has a ExternalBattery value that is at least newer than this time yesterday and has a BatteryLevelInVoltage higher than 24 volt.
Please also feel free to contact us for more complex rules and we can work with you to devise a formula to calculate this property.