Describe
1.The MQTT push service provided by Jointech is a service that sends device data to data users in real time. When the device uploads data, the push service will sense it immediately, organize and package the data, and send it to the MQTT server. The customer data receiving service obtains data from the MQTT server, and then the customer processes the data according to his own business.
2.The MQTT rule configuration interface is mainly used to facilitate users to configure which devices to use for MQTT push services
3.Subscription topic description
MQTT Rule Configuration
In this interface, users can configure the devices that need to be pushed by MQTT. By selecting the data source, users can select the devices that need to be pushed in multiple ways.



Data source description
1.All devices of the company
Indicates all devices under the current company and its subsidiaries
2.Company-owned devices
Indicates the current company and all the devices under it
3.Company specified devices
Indicates the designated devices under the current company and its subsidiaries
Subscription topic and payload description
Replace {accessKey} with the actual value assigned by the system and {deviceNum} with the ID of the device
Subscription topic |
Description |
upload/{accessKey}/# |
Subscribe to all types of data on all devices |
upload/{accessKey}/{deviceNum}/# |
Subscribe to all types of data on a device |
upload/{accessKey}/+/location |
Subscribe to all device location data |
upload/{accessKey}/{deviceNum}/location |
Subscribe to a device location data |
upload/{accessKey}/+/alarm |
Subscribe to all device alarm data |
upload/{accessKey}/{deviceNum}/alarm |
Subscribe to a device alarm data |
upload/{accessKey}/+/event |
Subscribe to all device event data |
upload/{accessKey}/{deviceNum}/event |
Subscribe to a device event data |
upload/{accessKey}/+/cmd |
Subscribe to all device command response data |
upload/{accessKey}/{deviceNum}/cmd |
Subscribe to a device command response data |
upload/{accessKey}/{deviceNum}/{subLockNum}/sublock |
Subscribe to a slave lock(sensor) data on a device |
upload/{accessKey}/{deviceNum}/+/sublock |
Subscribe to all slave lock(sensor) data on a device |
download/{accessKey}/{deviceNum}/cmd |
Send a device command data to the terminal |
1.Server address and description
Parameter name |
Description |
Server address |
mqtt://mqtt.assetscontrols.com:1883 |
Protocol version |
MQTT 3.1.1 |
QoS Level |
Recommended QoS0 (at most once) |
2.Client account and password
The login account and password (after MD5 encryption) configured for the current MQTT rule can also be viewed directly in the details interface of the rule.
3.Subscription topic Description
3.1 Device status reporting
Topic:upload/{accessKey}/{deviceNum}/location
Description:devices positioning status data
e.g.:
{"assetId":"8052400203","battery":255,"cellSignal":31,"cells":"460,0,10352,188975300","direction":0,"expandInfo":"{\"angle\":\"null\",\"backBattery\":\"null\",\"fuels\":\"-1,-1,-1\",\"humidity\":\"0\",\"lux\":\"null\",\"networkType\":\"0\",\"pressure\":\"null\",\"reportType\":\"null\",\"temperature\":\"-1000.0\"}","gnssSignal":0,"gpsTime":"2025-02-07T07:26:30Z","latitude":22.6700711039462,"locType":2,"longitude":113.922999834147,"mileage":0,"recvTime":"2025-02-07T07:25:20.832Z","speed":0,"statusJson":"{\"lockRope\":0,\"lockStatus\":0}","voltage":"0.0"}
Json Field Description
Parameter name |
Type |
Description |
assetId |
String |
Device ID |
longitude |
Double |
longitude(WGS-84) |
latitude |
Double |
latitude(WGS-84) |
speed |
Integer |
speed(km/h) |
direction |
Integer |
direction(0~360) |
mileage |
Long |
mileage(km) |
gpsTime |
String |
Positioning time(UTC) |
recvTime |
String |
Receiving time(UTC) |
locType |
Integer |
Positioning type (0: no positioning; 1: GPS positioning; 2: base station positioning;3:Cells positioning) |
cellSignal |
Integer |
GPRS signal |
gnssSignal |
Integer |
Satellite signal |
cells |
String |
Cell code data is displayed in MNC, MCC, LAC and CID formats |
battery |
Integer |
Power, 255 indicates charging |
voltage |
String |
Voltage(V) |
statusJson |
String |
Lock/vehicle mounted status JSON (refer to the status JSON description below) |
expandInfo |
String |
Extension information JSON (refer to the following extension information JSON description) |
Lock Status JSON Description
Parameter name |
Type |
Description |
lockRope |
Integer |
Rope locking status (1: pulling out; 0: inserting; - 1: none) |
lockStatus |
Integer |
Lock status (0: Off; 1: On) |
Vehicle status JSON description
Parameter name |
Type |
Description |
acc |
Integer |
Engine switch status (1: On; 0: Off; 1: None) |
fuelCut |
Integer |
State of oil cut-off electric switch (1: On; 0: Off; 1: None) |
door |
Integer |
Door opening/closing status (1: open; 0: close; - 1: none) |
engine |
Integer |
Engine status (1: On; 0: Off; 1: None) |
JSON description of extension information
Parameter name |
Type |
Description |
temperature |
String |
Temperature - 1000 means none |
humidity |
String |
Humidity 0 means none |
fuels |
String |
Oil level value - 1 means none (“- 1, - 1, - 1”) |
fAcceleration |
String |
acceleration(formats:”x: 1; y: - 29; z: - 2903”) |
lux |
float |
Illuminance(lux) |
pressure |
float |
pressure(pa) |
posture |
String |
Posture (formats:”x: 1; y: - 29; z: - 2903”) |
fVoltage |
Double |
Voltage value(V) |
backBattery |
String |
Backup battery (“55,3.88,0”) |
fReportType |
Integer |
Data type (0: real-time; 1: supplementary report; 2: alarm) |
fNetworkType |
Integer |
Network type (0: unknown 1:1G 2:2G 3:3G 4:4G 5:5G) |
3.2 Device alarm reporting
Topic:upload/{accessKey}/{deviceNum}/alarm
Description:device alarm data, such as low battery, lock rope cut alarm
e.g.:
{"alarmType":44,"assetId":"8454601010","cells":"460,0,9383,149428936","dateTime":"2020-04-01T00:00:25Z","describe":"","fileIndex":"1585728025","latitude":22.6766686619127,"longitude":113.928864975252,"mileage":59,"speed":0}
Json Field Description
Parameter name |
Type |
Description |
assetId |
String |
Device ID |
alarmType |
Integer |
Alarm type (refer to the following description of alarm type) |
dateTime |
String |
Time (UTC time) |
longitude |
Double |
longitude(WGS-84) |
latitude |
Double |
latitude(WGS-84) |
speed |
Integer |
speed(km/h) |
mileage |
Long |
mileage(km) |
cells |
String |
Cell code data is displayed in MNC, MCC, LAC and CID formats |
describe |
String |
alarm describe |
fileIndex |
String |
Serial number of files |
Alarm Type Description:
Alarm Type |
Alarm Name |
1 |
Speeding Alarm |
2 |
Fatigue driving |
3 |
Danger warning |
4 |
GNSS module failure |
5 |
GNSS antenna not connected or cut off |
6 |
GNSS antenna short circuit |
7 |
device main power supply under voltage |
8 |
Power failure of device main power supply |
9 |
device LCD or display failure |
10 |
TTS module failure |
11 |
Camera fault |
12 |
IC card module failure |
13 |
Speeding warning |
15 |
Power failure |
19 |
Overtime parking |
23 |
Route deviation alarm |
24 |
Vehicle VSS failure |
26 |
Vehicle theft |
27 |
Illegal vehicle ignition |
28 |
Illegal vehicle displacement |
29 |
Collision warning |
30 |
Rollover warning |
31 |
Illegal door opening alarm |
32 |
Video signal loss alarm |
33 |
Video signal blocking alarm |
34 |
Storage unit failure alarm |
35 |
Other video equipment fault alarm |
36 |
Passenger train overload alarm |
37 |
Abnormal driving behavior alarm |
38 |
Video recording reaches storage threshold alarm |
40 |
Lock rope cut |
41 |
Vibration |
42 |
Long-time unlocking |
43 |
Unlock password error for 5 consecutive times |
44 |
Swiping illegal RFID card |
45 |
Low power |
46 |
Back cover opened |
47 |
Motor stuck |
48 |
Enter fence alarm |
49 |
Exit fence alarm |
50 |
Enable backup battery |
51 |
SOS |
52 |
Towing alarm |
54 |
Fuel level change alarm |
55 |
Enter hot spot alarm |
56 |
Exit hot spot alarm |
57 |
Access road alarm |
58 |
Exit road alarm |
63 |
Temperature and humidity alarm |
64 |
Forward collision alarm |
65 |
Lane departure alarm |
66 |
Too close distance alarm |
67 |
Pedestrian collision alarm |
68 |
Frequent lane change alarm |
69 |
Road sign overrun alarm |
70 |
Obstacle alarm |
71 |
Road sign recognition events |
72 |
Active capture event |
73 |
Lane changing of solid line |
74 |
Pedestrian monitoring in car aisle |
92 |
Fatigue driving alarm |
93 |
Call the police |
94 |
Smoking alarm |
95 |
Distracted driving alarm |
96 |
Driver abnormal alarm |
97 |
Auto capture events |
98 |
Driver change event |
99 |
Probe blocked |
100 |
Overtime driving |
101 |
Not wearing seat belt |
102 |
Infrared blocking sunglasses failure |
103 |
Hands off the steering wheel |
104 |
Playing with phone |
110 |
Tire pressure alarm |
125 |
Rear approach alarm |
126 |
Left rear approach alarm |
127 |
Right rear approach alarm |
131 |
Rapid acceleration |
132 |
Emergency deceleration |
133 |
Emergency turning |
134 |
Idle alarm |
135 |
Abnormal flameout |
136 |
Neutral skid alarm |
137 |
Engine overspeed |
141 |
Overspeed |
145 |
Excess load of vehicle |
146 |
Excess load of road |
151 |
Height limit alarm |
160 |
Safety belt alarm |
161 |
Emergency brake alarm |
162 |
Neutral skating |
163 |
GPRS reconnection |
164 |
Dispatching panel connection |
165 |
Dispatch panel disconnected |
166 |
CANbus disconnection alarm |
167 |
CANbus fault code upload alarm |
168 |
Limit drive alarm |
180 |
Host dismantling |
190 |
Damage of upper cover |
191 |
GPS antenna interference |
192 |
Low power sleep alarm |
193 |
Device exception |
194 |
Unlock password error |
195 |
Do not perform unlocking without positioning |
196 |
No unlocking outside the fence |
197 |
Attitude alarm |
198 |
Slave sensor signal lost |
199 |
Supervision status forbids unlocking |
200 |
Main battery replacement |
201 |
Self-check exception |
202 |
not enough storage space |
203 |
Lock bar bent |
204 |
Chain saw off |
205 |
lock bar missing |
206 |
Forbidden to unlock in the sealed state |
316 |
Light alarm |
332 |
Pressure alarm |
400 |
Idling alarm |
402 |
Fence stop alarm |
403 |
Out fence unlock |
404 |
Departure delay warning |
405 |
Departure delay alarm |
406 |
Late warning |
407 |
Late alarm |
3.3 device event reporting
Topic:upload/{accessKey}/{deviceNum}/event
Description:device event data, such as unlocking and locked
e.g.:
{"assetId":"8454601010","card":"","cells":"460,0,9383,149428936","dateTime":"2025-02-07T06:54:52Z","describe":"","eventType":1,"latitude":22.6766686619127,"longitude":113.928864975252,"mileage":59,"password":"","speed":0,"unLockType":2}
Json Field Description
Parameter name |
Type |
Description |
assetId |
String |
Device ID |
eventType |
Integer |
Event type (refer to the following description of event type) |
unLockType |
Integer |
Unlocking type, only for lock on/off events (1: swipe card to unlock 2: remote unlock 3: Bluetooth unlock 4: cut rope to unlock 5: SMS unlock 6: regional trigger) |
dateTime |
String |
Time (UTC time) |
longitude |
Double |
longitude(WGS-84) |
latitude |
Double |
latitude(WGS-84) |
speed |
Integer |
speed(km/h) |
mileage |
Long |
mileage(km) |
cells |
String |
Cell code data is displayed in MNC, MCC, LAC and CID formats |
card |
String |
Swipe card No,only for lock products |
password |
String |
unlock password,only for lock products |
describe |
String |
Description information. For route analysising waybill events 13-18, the description will have a Json string value, showing the waybill unique identifier (waybillGUID) and waybill number(Declaration No.) |
3.4 Command response report
Topic:upload/{accessKey}/{deviceNum}/cmd
Description:The device responds to the commands sent by the platform
Command response description:Different commands have different response results. For specific commands and their descriptions, please refer to the protocol document.
e.g.:
//command operation success response
{"assetId":"794308010642","commandType":"BASE1","content":"[\"794308010642\",\"8\",\"001\",\"BASE\",\"1\",\"JT709A_20241115_HW-V1.2_RFID_7600_V2_8\",\"0\",\"Jointech\",\"LE20B05SIM7600M21-A_CUS_JT\",\"898604B81022C1046673\",\"868822046635957\",\"460\",\"0\",\"188975300\",\"10352\"]","dateTime":"2025-02-07T03:52:39.964Z"}
//command operation failed response (Device not online)
{"assetId":"8294630003","commandType":"MQTT_CMD","content":"Device not online!","dateTime":"2025-01-07T09:49:43.158Z"}
//command operation failed response (Device has not been registered)
{"assetId":"8294630481","commandType":"MQTT_CMD","content":"Device has not been registered!","dateTime":"2025-01-07T09:48:32.975Z"}
Json Field Description
Parameter name |
Type |
Description |
assetId |
String |
Device ID |
commandType |
String |
Command type |
content |
String |
Equipment response content |
dateTime |
String |
Time (UTC time) |
3.5 Slave lock(sensor) data reporting
Topic:upload/{accessKey}/{deviceNum}/{subLockNum}/sublock
Description:Slave Device positioning data, including Device ID, positioning time, longitude and latitude, speed, mileage and other information
e.g.:
{"assetId":"8052400203","battery":41,"direction":0,"eventType":3,"gpsTime":"2025-02-07T07:16:07Z","humidity":0,"latitude":-0.0,"locRope":0,"locStatus":0,"locTimes":54,"longitude":-0.0,"recvTime":"2025-02-07T07:14:57.315Z","rssi":15,"sensorType":4,"speed":0,"statusJson":"{\"lockRope\":0,\"gateway\":0}","subAssetID":"E0171E0366","subGpsTime":"2025-02-07T07:15:14Z","subGpsTimestamp":1738912514000,"temperature":-1000.0,"voltage":"3.75"}
JsonField Description
Parameter name |
Type |
Description |
assetId |
String |
Device ID |
longitude |
Double |
longitude(WGS-84) |
latitude |
Double |
latitude(WGS-84) |
speed |
Integer |
speed(km/h) |
direction |
Integer |
direction(0~360) |
mileage |
Long |
mileage(km) |
gpsTime |
String |
Positioning time(UTC) |
recvTime |
String |
Receiving time(UTC) |
subAssetID |
String |
Slave Equipment No |
subGpsTime |
String |
Slave Positioning time(UTC)) |
subGpsTimestamp |
Long |
Slave Positioning timestamp |
battery |
Integer |
Slave Power |
voltage |
String |
Slave voltage (V) |
sensorType |
Integer |
Slave Type 1-JT126 , 4-JT709 , 5-JT801 , 6-JT802 |
locStatus |
Integer |
Slave lock status 0-Off 1-On |
locRope |
Integer |
Slave Rope locking status (1: pulling out 0: inserting - 1: none) |
rssi |
Integer |
RSSI |
humidity |
Integer |
Slave Temperature - 1000 means none |
temperature |
double |
Slave Humidity 0 means none |
locTimes |
Integer |
Slave unlock times |
eventType |
Integer |
Slave Event -1:none 0:Lock event 1:BLE unlock event 2:Open back cover waring 3:Lora unlock event 4:Lock rope cut warning 5:Key wake up event 6:Heartbeat packet 7:Charging report event 8/20:Pull out the lock rope event 9:RFID unlock event 10:Illegal RFID unlock warning 14:Sub lock signal lost warning 15:Valve closed event 16:Valve open event 17:Low battery warning 18:Anti-disassembly 19:Disassembly of electronic compartment 21:Lock rope insertion 22:Bluetooth connection 23:Open emergency storage warning 24:Close emergency storage warning 25:Valve abnormally open warning 26:Turn off the knob event 27:Turn on the knob event 28:Unlocking Error 29:Abnormal Motor 30:NFC trigger |
statusJson |
String |
For 802 device status data (Json string), other types of device data can be ignored |
statusJson Field Description
“FStatusJson”:”{"bottomDisassembly":0,"emergencyKey":0,"lockMotor":0,"structuralDisassembly":0,"gateway":0,"lockValve":0}”
Parameter name |
Type |
Description |
bottomDisassembly |
Integer |
bottom disassembly status,0:No disassembly,1:disassembly |
emergencyKey |
Integer |
emergency key status 0:Seal up,1:Enable |
lockMotor |
lock motor status:0:Off,1:On |
|
structuralDisassembly |
Integer |
structural disassembly status,0:No disassembly,1:disassembly |
lockValve |
Integer |
Lock Valve status,0:Off,1:On |
lockKnob |
Integer |
Lock Knob status,0:Off,1:On |
lockRope |
Integer |
Rope locking status 0:inserting;1:pulling out |
gateway |
Integer |
Meaningless, can be ignored |
3.6 Platform send command
Topic:download/{accessKey}/{deviceNum}/cmd
Description:Send command to the terminal data
command Description:Different device types have different command functions. For specific commands and their descriptions, please refer to the protocol documentation.
e.g.:
(794308010642,1,001,BASE,1)
Code Sample
Introducing paho dependency
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.0</version>
</dependency>
Establishing an MQTT connection
When establishing a connection, you need to use AccessId, secret, topic, and clientId, which are all assigned by the system. AccessId corresponds to the client’s user, and secret corresponds to the client’s password.
String user = "u8vngl";
String password = "xxxxxx";
String topic = "upload/{accessKey}/{deviceNum}/location";
int qos = 1;
String broker = "mqtt://mqtt.assetscontrols.com:1883";
String clientId = "u8vngl_consumer";
MemoryPersistence persistence = new MemoryPersistence();
try {
MqttClient client = new MqttClient(broker, clientId, persistence);
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setUserName(user);
connOpts.setPassword(password.toCharArray());
connOpts.setCleanSession(false);
connOpts.setAutomaticReconnect(true);
client.setCallback(new MqttCallback());
client.connect(connOpts);
client.subscribe(topic, qos);
} catch(MqttException me) {
me.printStackTrace();
}
Get subscription messages
Paho gets messages by implementing the MqttCallback interface, which gets messages through the messageArrived method
@Override
public void messageArrived(String topic, MqttMessage message) throws Exception {
System.out.println("topic:" + topic + " msg:" + message);
}
@Override
public void connectionLost(Throwable cause) {
cause.printStackTrace();
while (true) {
try {
if (!client.isConnected()) {
client.reconnect();
}
if (client.isConnected()) {
client.subscribe(topic, qos);
System.out.println("has resubscribed");
break;
}
TimeUnit.SECONDS.sleep(100);
} catch (MqttException | InterruptedException e1) {
e1.printStackTrace();
}
System.out.println("client not connect");
}
}
文档更新时间: 2025-02-20 15:17 作者:Jeson