Tracking temperature in GpsGate

The right temperature is critical for the transport of food, medicine, animals, and other sensitive goods. It is important that any temperature deviations are quickly detected and alerted upon. With a suitable tracking device and scripting, it is easy to add advanced temperature monitoring to your GpsGate Server.


This article is another example of how to create advanced solutions using script expressions. The sample scripts and reports below form a solution for monitoring transports with multiple temperatures. For more information about script expressions, see this article.

We will create two event rules; one that will check temperature exceptions for a truck with multiple compartments, which are distinguished by different temperature requirements. The other event rule will generate a temperature profile for each trip and vehicle. We only use two temperature intervals in this example, but it is easy to add more content to the script, to meet your own business needs.


This is the data that the scripts are monitoring:

  1. What compartment or box is causing the temperature exception, what was the limit, and what was the actual temperature in terms of minmax, and average?
  2. How does the temperature profile look like in terms of min, max, and average for each trip (run, idle, and parked)?


The scripts and reports are exported and available for download. Follow these steps to install them:

  1. Download this .zip file and extract the XML files.
  2. Import the event rules Multi Temperature Exceptions.xml and Trip & Idle Multi Temperatures.xml in Vehicle Tracker. See this article for help.
  3. Import the reports TE1000 Temperature Exceptions.xml and TE1000 Trip & Idle Temperatures.xml. Go to Site Admin → Import, choose “template”. Click on “Choose file,” choose your reports, and click on Import.
  4. Follow the instructions to activate these reports.

Device Mapper

The first part of the script fetches the temperatures. You need to configure the device mapper for this to work. We only use two temperatures in this example, but you are free to add more temperature sensors as long as 1‐Wire® is supported for your device. You will find suitable trackers among several vendors like ATrack, Teltonika, Wireless Links, and SysTech. Map the temperature sensors to “Temperature” and “Temperature2” according to the picture.


Custom Fields

You also need to create the Custom Fields below for the script to work out. You can modify them later for your own needs.

See how to set up custom fields

Variable Description
tempMinForBox1 Minimum temperature for compartment or box 1        
tempMaxForBox1 Maximum temperature for compartment or box 1        
tempMinForBox2 Minimum temperature for compartment or box 2        
tempMaxForBox2 Maximum temperature for compartment or box 2        



When a temperature passes one of the limits defined in the custom fields above, an event will be triggered. You have already imported and activated “TE1000 Temperature Exceptions” and “TE1000 Trip & Idle Temperatures”,  in your server and should be able to see something similar to the reports you see below as long as you have some tracks recorded in your application.
The scripts produce a few variables that are used in these reports.

Variable Description
State Contains one of three states; run, idle, or parked.
AvgTemperature1 The average temperature for compartment or box 1 during a trip.
AvgTemperature2 The average temperature for compartment or box 2 during a trip.
Average temperature The average temperature during the temperature exception.
Limit temperature What temperature limit was there for the exception?
Box temperature Which compartment or box triggered the temperature exception, and was the temperature higher or lower than the limit?
Extreme temperature What was the actual temperature in terms of min or max?

TE1000 Trip & Idle Temperatures


TE1000 Temperature Exceptions


Tips & Tricks

When testing the “Trip & Idle Multi Temperatures” script, you can modify input to the script only by clicking on specific track points in your vehicle tracker application. 

It is up to you how you choose to use these events; a notification in the GUI, a report or an SMS notification. You can use the variables above for SMS notifications, allowing concerned people to act directly, depending on the values. This is valid for the “Multi-Temperature Exception” script as long as the event rule is enabled.

Trip and idle data is a part of reporting data, available only if you set the event rule that you want to use it in, to “Disabled”. This is valid for the “Trip & Idle Multi Temperatures” event rule. In this way, the rule is not evaluated in live mode, but you can still generate reports for it.