Skip to content

Tutorial: Create your Fleet Management System

Panos Kalogeropoulos edited this page Oct 6, 2023 · 13 revisions

DRAFT

Introduction

Using Teltonika's GPS Trackers, OpenRemote offers full fleet tracking and management functionalities. Using the incredibly flexible backbone of the OpenRemote platform, the Fleet Management implementation offers the same degree of flexibility while closely integrating with Teltonika GPS trackers.

Requirements

  • Any number of Teltonika GPS Devices, with:
    • The ability to use a TLS certificate;
    • The ability to transmit MQTT messages;
    • The ability to use the Codec JSON protocol.
  • The same amount of SIM cards capable of mobile data usage (and preferrably SMS messaging).
  • Preferably, pre-assign each SIM card to a tracker, and each tracker to each vehicle, so that you know which vehicle contains which device IMEI with which phone number.

Setup and Installation

Set up OpenRemote on a publically accessible hostname

  • Use the regular OpenRemote deployment tutorial to deploy OpenRemote with SSL.

  • If SSL has been successfully been setup, then grab the full TLS certificate chain from the certificate.

To grab the certificate chain file, grab the file from the or-proxy-1 container, in the directory deployment/letsencrypt/live/{your domain-name}/fullchain.pem.

  • Ensure that the OpenRemote MQTT broker is accessible using TLS and ensure port 8883 is reachable.

Configure your Teltonika devices with the following settings:

Download the most recent Teltonika Configurator that is recommended for your device.

  • In the GPRS tab:
    • Setup your own APN settings and ensure GPRS traffic is allowed.
    • Setup your Server Settings:
      • Set the Domain to your domain name;
      • Set the protocol to MQTT;
      • Set the TLS Encryption to TLS/DTLS.
    • In the new MQTT Settings category, insert:
      • Leave Device ID empty;
      • The data topic should look like {realm Name}/{random client ID}/teltonika/%imei%
      • The commands topic should look like {realm Name}/{random client ID}/teltonika/%imei%/commands

If the MQTT button is not visible, then it means that your device does not support the MQTT transfer protocol. Ensure that your device supports it and/or upgrade to the most recent firmware version available for your device.

  • In the Security tab:

    • If required, enter your PIN number for the sim card.
    • Upload the fullchain.pem file to the Certificates section.
  • In the System tab:

    • Select Codec JSON in the Data Protocol section

If the Codec JSON button is not visible, then it means that your device does not support the JSON data protocol. Ensure that your device supports it and/or upgrade to the most recent firmware version available for your device.

  • Modify any other parameters of the device needed

  • Save the configuration to the device and ensure that OpenRemote is receiving the data as required.

  • Install the device to your vehicle (Boat, plane, car, farming equipment, etc.)

Fleet assets and handlers

Car Asset

The Car Asset is the basic fleet management asset type used. For added functionality, you can inherit the Car Asset Type and extend its attributes, optional or not.

Teltonika FMC003 JSON mapper

To automatically be able to parse the data supplied by the tracker for any type of Teltonika device, other than being able to communicate with the device and retrieve its data, we will also need to be able to decode the message's contents.

Teltonika transfers its data by providing a parameter ID and then that parameter's value. Each Teltonika GPS Tracker model may have different IDs for different devices, and different sets of parameters for different devices. For example, an advanced tracker with CAN connectivity will not have the same amount of available parameters as a device that does not interface with the car other than the car's battery.

Hence, we have written a custom Python program that is able to retrieve the parameter data. By running that script for your model name, you are able to retrieve the official parameter data from Teltonika's website. By default, the parameter data for our test device, the FMC003, is included in the installation. You can add your own files for your respective device.

MQTT Handler

To be able to retrieve and use the data sent by each Teltonika device, a special Teltonika MQTT Handler has been implemented within OpenRemote. It is adjusted to understand the JSON payload sent by the device. It analyzes the data and inserts each parameter (attribute) sent, into the appropriate CarAsset.


Using Fleet Management with Rules

One important use case is to receive alerts in case certain parameters of the tracker are found to be outside a range. Whether that is the coordinates of the device, the speed, or even the temperature of the carriage, Teltonika's flexible devices and OpenRemote's generic interfacing have got you covered.

To be able to use custom parameters for rules, we would need to extend the attributes available by inheriting the Car Asset. By including specific parameters that you would need, you would then be able to use those parameters for your rules, that apply for either every asset of your asset type, or a specific vehicle.

Example 1

As a rental company, it is important to be aware of the location of all vehicles at any point in time. By installing a Teltonika GPS tracker, management is able to not only track its location, but to understand the driving behavior of each driver, and depending on the behavior, act automatically, using rules.

Implementation

To ensure that all clients remain within a certain range, or within a certain province, country, or region, we can employ the when-then rules for the location attribute on all assets of type CarAsset, requiring them to be within the range of our choice. By creating that rule, the data of the geofence is sent to the device which saves the data in its configuration. Along with that rule, we can send a webhook, email, or push notification, to specific users, when it is triggered. With SECO-enabled trackers, we can securely cutoff the engine by stopping electricity flow to the fuel pump.

Thus, we are able to stop any client from leaving the specified areas, and then let the administration with push notifications, emails, custom webhooks, etc.

Example 2

For a refrigerated shipping company, it is important to be aware of any undesired fluctuations in the temperature of the refrigerated carriage. As such, the vehicles in their fleet are all equipped with the FMC650, and the trucks have been connected to the respective cooler units.

Solution

By implementing the CarAsset, we are able to add the required parameter IDs as attributes, for example Zone 1 Temperature. When configured in the rules, we can set the parameter to be set between -7 and -1 degrees. If the temperature is outside this threshold, management is notified, at which point the driver is able to be notified to diagnose the issue.

DISCLAIMER: OPENREMOTE SHALL UNDER NO CIRCUMSTANCE BE LIABLE FOR ANY DAMAGES ARISING OUT OF ILLEGALLY USING UNOFFICIAL, NOT VENDOR AGREED OR APPROVED, API'S

Clone this wiki locally