- Description
- Getting Started
- Provisioning the device for Thingsboard
- Syrus 4G IoT Telematics Gateway Configuration
- Check your data in Thingsboard demo account
Description
Here's a detailed integration example between Syrus 4G IoT Telematics Gateway with Thingsboard Platform over MQTT connection.
Getting Started
Syrus 4G IoT Telematics Gateway.
Provisioning the device for Thingsboard
For simplicity, we will provision device manually using the UI.
1. Login to your ThingsBoard instance and open Devices page.
Click on the "+" icon in the top right corner of the table and then select "Add new device".
Input device name. For example, "Syrus". No other changes are required at this time. Click "Add" to add the device.
Now your device should be listed first, since the table sorts the devices by using created time as default.
2. Token creation
To connect the device you need to get the device credentials first. ThingsBoard supports different device credentials. We recommend using default auto-generated credentials which is an access token for this guide.
Click on the device row in the table to open device details
Click "Copy access token". Token will be copied to your clipboard. Save it to a safe place.
Syrus 4G IoT Telematics Gateway Configuration
The first step to do is make sure you have the latest version of Apex OS
1. Preparing your System
Go to Management Tool (http://192.168.9.2) if you're over USB cable), select System and confirm that you're up to date
Now go to Applications Manager and Check for updates and make sure you have the latest version of SyrusJS application installed:
2. Create an instance
In application manager pull down the menu of SyrusJS, this will show you all versions installed of the application, select the latest one and Create a New Instance:
Name your instance and select the "Create Instance" button:
Now you have your instance created:
3. Creating your configuration files
We need to create two files on any notepad application (notepad++, sublime, vscode, etc), you can name it as you want but the extension must be syrus.conf
One file contains the destination data, protocol, output format, MQTT URI, username and topics.
you may define custom MQTT topics in the MQTT transport configuration. See transport configuration
here is an example:
Replace [YOUR_TOKEN] with the copied access token you got from Thingsboard when you created the device.
More information about: https://syrus.pegasusgateway.com/syrdocs/syrus4/syruslang/#destinations
The second file contains all the events that will be sent to the Thingsboard over MQTT, here is an example, this will send Ignition On/Off events and track points every minute:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
_####### ###### ####### ###### #######_
_############ START MQTT EVENT ###########_
define variable constant_1 1
define fieldset thingsboard
fields="ident":$modem.imei,position.context.lat:$gnss.latitude,position.context.lng:$gnss.longitude,
position.value:$variables.constant_1,"position.direction":$gnss.heading,"position.hdop":$gnss.hdop,
"position.pdop":$gnss.pdop,"position.vdop":$gnss.vdop,"position.speed":$gnss.mph,
"position.altitude":$gnss.altitude,"event.enum":code,"can.engine.rpm":$ecu.rpm,
"can.throttle.pedal.level":$ecu.accel_pedal_position,"can.engine.temperature":$ecu.coolant_temp,
"can.fuel.consumed":$ecu.fuel_total,"can.intake.map":$ecu.intake_manif_pressure,
"can.vehicle.speed":$ecu.fe6c_7-8,"can.fuel.temperature":$ecu.fuel_temp,"can.engine.load":$ecu.engine_load,
"can.engine.torque":$ecu.actual_engine_torque,"can.catalyst.outlet.temp":$ecu.aftmt_catalyst_outlet_gas_temp
"can.fuel.rate":$ecu.fuel_rate,"can.engine.hours":$ecu.hours_total,"can.ambient.temp":$ecu.ambient_air_temp,
"can.oil.pressure":$ecu.oil_pressure
define group thingsboard
set destinations group=thingsboard thingsboard
define tracking_resolution thingsboard_tracking 5m 25deg 1000mts
define signal ignitionON min_duration=5s $io.ign == true
define signal ignitionOFF min_duration=5s $io.ign == false
define event ignitionONmqtt group=thingsboard fieldset=thingsboard ack=seq label=ignonmqtt code=102 trigger=ignitionON
define event ignitionOFFmqtt group=thingsboard fieldset=thingsboard ack=seq label=ignoffmqtt code=103 trigger=ignitionOFF
_# Define tracking event, a single tracking resolution signal that can be controlled by different actions
define event trackingOffMqtt group=thingsboard fieldset=thingsboard ack=seq label=prdtst code=100 trigger=@tracking_resolution.thingsboard_tracking.signal,ignitionOFF,and
define event trackingOnMqtt group=thingsboard fieldset=thingsboard ack=seq label=trckpnt code=101 trigger=@tracking_resolution.thingsboard_tracking.time,ignitionON,and
define event trackingHeadingMqtt group=thingsboard fieldset=thingsboard ack=seq label=heading code=140 trigger=@tracking_resolution.thingsboard_tracking.heading,ignitionON,and
define event trackingDistanceMqtt group=thingsboard fieldset=thingsboard ack=seq label=distance code=141 trigger=@tracking_resolution.thingsboard_tracking.distance,ignitionON,and
_############ END MQTT EVENT ###########_
_####### ###### ####### ###### #######_
define event trackingOnMqtt group=mqtt fieldset=mqtt ack=seq label=trckpnt code=101 trigger=@tracking_resolution.mqtt_tracking.time,ignitionON,and
define event trackingHeadingMqtt group=mqtt fieldset=mqtt ack=seq label=heading code=140 trigger=@tracking_resolution.mqtt_tracking.heading,ignitionON,and
define event trackingDistanceMqtt group=mqtt fieldset=mqtt ack=seq label=distance code=141 trigger=@tracking_resolution.mqtt_tracking.distance,ignitionON,and
_############ END MQTT EVENT ###########
_####### ###### ####### ###### #######
If you need more information about how to configure more events please refer to SyrusLang documentation:
https://syrus.pegasusgateway.com/syrdocs/syrus4/syruslang
4. Upload your configuration files
Select your created instance:
Go to Data Folder Tab:
Select Upload File:
And search in your local disk the previous configurations files created, and upload it one by one
Go to Configuration tab, pull down in Configuration and Destination File, select you previously updated items and click Save button:
5. Start your instance
Finally, go back to the Information tab and click the Start button:
Check your data in Thingsboard demo account
The reported variables are automatically created according to the fieldset configuration.
Go to Devices, choose Syrus 4 and click "Latest telemetry"
Now you can use Thingsboard's tools to design your own dashboard with Syrus 4G data: