queclink-parser 1.9.14 → 1.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ #### 1.9.15 (2025-03-11)
2
+
3
+ ##### New Features
4
+
5
+ * **tirepressure:** se incorpora presión de ntco en PSI e interpretación de rawData BLE ([a263d70f](https://github.com/jaayesta/queclink-parser/commit/a263d70f1b2a358ed2cdcd414ad445e5f158f16c))
6
+ * **rf433:** started support for RF433 devices ([2f4f5d9b](https://github.com/jaayesta/queclink-parser/commit/2f4f5d9bf680be49e52c7f931430bae80a905d74))
7
+
8
+ ##### Bug Fixes
9
+
10
+ * **messages:** se actualiza mensaje en ACK BTS ([1307d12f](https://github.com/jaayesta/queclink-parser/commit/1307d12f07922d1dfc4870b348126adaf92bb2d8))
11
+ * **tirepressure:**
12
+ * se quita linea de debug ([91794b17](https://github.com/jaayesta/queclink-parser/commit/91794b17672298ec754ff22ab7d78425aaf5a801))
13
+ * alarma de presión en PSI ([3f7262c1](https://github.com/jaayesta/queclink-parser/commit/3f7262c1b984b4899fb612b3d8c3498341191a95))
14
+
1
15
  #### 1.9.14 (2025-01-27)
2
16
 
3
17
  ##### New Features
package/example.js CHANGED
@@ -79,12 +79,14 @@ var test = '+RESP:GTERI,6E0B00,868589060064048,,00000100,12109,10,1,1,0.0,83,3.1
79
79
  var test2 = '+RESP:GTERI,8020040802,866314061760094,,00000100,12217,10,1,0,0.0,114,89.4,-71.542946,-32.972462,20250117083107,0730,0003,EA6F,00070B34,01,0,12.0,0000100:49:34,,,,100,210100,,2,00,13,0,00000000,4007,,78054143F00B,1,0,01,6,4,17C608B8,283F,,78054133CB9F,1,3443,22,60,22.32,100,20250121174252,7B18$'
80
80
  var test3 = '+RESP:GTERI,8020040802,866314061760094,,00000100,12217,10,1,0,0.0,114,89.4,-71.542946,-32.972462,20250117083107,0730,0003,EA6F,00070B34,01,0,12.0,0000100:49:34,,,,100,210100,,2,01,6,4,17C608B8,283F,,78054133CB9F,1,3443,22,60,22.32,100,00,13,0,00000000,4007,,78054143F00B,1,0,20250121174252,7B18$'
81
81
  var test4 = '+RESP:GTERI,6E0B00,868589060064048,,00000100,12141,10,1,1,0.0,0,2.5,-71.543408,-32.972433,20250121211122,0730,0001,13EE,0032A502,01,12,2.6,0000014:48:01,,,,100,210100,0,3,FE,3,4,000A,780541416165,3260,00,13,0,00000000,4006,78054143F00B,1,0,02,6,4,156A0A3E,283F,,78054133CB9F,1,3449,26,54,26.22,100,20250121211125,340A$'
82
-
82
+ var juego = "+RESP:GTERI,6E0802,868589060659029,,00000006,14064,10,1,1,32.4,71,471.3,-70.748220,-33.494213,20250123150132,0730,0001,3344,003D0601,01,12,9150.7,0000381:44:02,,,,100,220100,2,1,28FFB007286384D2,1,FF4C,1,203FFFFF,,2,,1190.32,1626,32,90,,,,0,371.38,193.02,178.36,128.66,,FFFF,0010,,00,0.06,0.00,FFFFFF,,,,,,,,,576370,434493,1719,371.38,,1.42,23731,,,,,,0000,56,0,,20250123150133,FAD9$"
83
+ var tpms = '+RESP:GTERI,6E1003,864696060004173,GV310LAU,00000100,,10,1,1,0.0,0,115.8,117.129356,31.839248,20230808061540,0460,0001,DF5C,05FE6667,03,15,4.0,0000102:34:33,0,15259,10680,100,210000,7,1,1,06,12,0,001A42A2,0617,TMPS,08351B00043C,1,26,65,20231030085704,20231030085704,0017$'
84
+ var newdtt = '+RESP:GTDTT,6E0802,868589060722215,,,,0,264,�Q4���,OzJ(��(��(��(��(��(��(��(��(��(��(��(��� N�K�4����.�]�f�v(�)sFisFisFh�����f�њ3I�3Mi���ܹ��QEQEQEQEQEQEQEQEQEQEQEQEQE(<Q��u.�7��}/�K��]��Jo���F�]�n�u��u.�i7 Rn��I��Ԍ�6M%QEQEQEQEQEQEQEQEQEQEQEQEQEQEQE.h���q��h�h�)][yB,1,24.6,322,2730.3,-68.802404,-23.413967,20250210162544,0730,0002,00CA,09B38E71,01,11,,,,,20250210162545,A522$'
83
85
 
84
86
  var data = {
85
87
  "imei": 868589060039404,
86
- "instruction": "temp_alarm_on",
87
- "sensor_type": 'WTH300',
88
+ "instruction": "temp_alarm_off",
89
+ "sensor_type": 'WTH301',
88
90
  "sensor_index": 1,
89
91
  "action": "Configurar alarma de temperatura",
90
92
  "device": "queclink",
@@ -96,9 +98,9 @@ var data = {
96
98
  }
97
99
 
98
100
  // console.log(queclink.parseCommand(data))
99
- const raw = new Buffer.from(test4)
101
+ const raw = new Buffer.from(tpms)
100
102
  console.log(JSON.stringify(queclink.parse(raw), null, 2))
101
- // queclink.parse(raw)
103
+ queclink.parse(raw)
102
104
 
103
105
  // if (data.can) {
104
106
  // const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "queclink-parser",
3
- "version": "1.9.14",
3
+ "version": "1.9.15",
4
4
  "description": "Parse raw data from Queclink devices",
5
5
  "main": "src",
6
6
  "scripts": {
package/src/gv310lau.js CHANGED
@@ -27,7 +27,6 @@ const parse = raw => {
27
27
  sentTime: utils.parseDate(parsedData[parsedData.length - 2]),
28
28
  serialId: parseInt(parsedData[parsedData.length - 1], 16)
29
29
  }
30
-
31
30
  // Gps
32
31
  if (command[1] === 'GTFRI') {
33
32
  try {
@@ -395,6 +394,8 @@ const parse = raw => {
395
394
  AC100 && digitFuelSensor
396
395
  ? parseInt(parsedData[index + 10], 10)
397
396
  : AC100 && !digitFuelSensor ? parseInt(parsedData[index + 9], 10) : 0
397
+ // Review when RF433 devices are implemented
398
+ const rf433DevicesConnected = parsedData[index + 8] === '7' ? parseInt(parsedData[index + 9]) : 0
398
399
 
399
400
  let externalData = {
400
401
  eriMask: {
@@ -540,6 +541,27 @@ const parse = raw => {
540
541
  AC100Devices: ac100Devices
541
542
  })
542
543
  }
544
+ // } else if (parsedData[index + 8] === '7') {
545
+ // index += 1
546
+ // // RF433 Devices
547
+ // let rf433Devices = []
548
+ // // Review when RF433 devices are implemented
549
+ // let count = index + 9
550
+ // for (var l = 0; l < rf433DevicesConnected; l++) {
551
+ // rf433Devices.push({
552
+ // // deviceNumber: parsedData[count],
553
+ // // deviceType: parsedData[count + 1],
554
+ // // deviceData: parsedData[count + 2]
555
+ // // ? utils.getTempInCelciousDegrees(parsedData[count + 2])
556
+ // // : null
557
+ // deviceData: parsedData[count]
558
+ // })
559
+ // count += 1
560
+ // // count += 3
561
+ // }
562
+ // externalData = Object.assign(externalData, {
563
+ // rf433Devices: rf433Devices
564
+ // })
543
565
  }
544
566
 
545
567
  if (canData) {
@@ -2043,7 +2065,7 @@ const parse = raw => {
2043
2065
  : null,
2044
2066
  tirePresure:
2045
2067
  parsedData[pressIx] !== '' && appendMask[6] === '1'
2046
- ? parseInt(parsedData[pressIx])
2068
+ ? parseInt(parsedData[pressIx]) / 6.895
2047
2069
  : null,
2048
2070
  timestamp:
2049
2071
  parsedData[timeIx] !== '' && appendMask[5] === '1'
package/src/gv58lau.js CHANGED
@@ -1780,7 +1780,7 @@ const parse = raw => {
1780
1780
  : null,
1781
1781
  tirePresure:
1782
1782
  parsedData[pressIx] !== '' && appendMask[6] === '1'
1783
- ? parseInt(parsedData[pressIx])
1783
+ ? parseInt(parsedData[pressIx]) / 6.895
1784
1784
  : null,
1785
1785
  timestamp:
1786
1786
  parsedData[timeIx] !== '' && appendMask[5] === '1'
@@ -300,7 +300,7 @@
300
300
  "GTVVS": "Config: ignición virtual",
301
301
  "GTAVS": "Config: ignición por acelerómetro",
302
302
  "GTVMS": "Config: modo de ignición",
303
- "GTBTS": "Config: protocolo bluetooth",
303
+ "GTBTS": "Config: general bluetooth",
304
304
  "GTBAS": "Config: accesorio bluetooth",
305
305
  "GTBID": "Config: baliza bluetooth",
306
306
  "GTHMC": "Config: horómetro",
package/src/utils.js CHANGED
@@ -211,7 +211,7 @@ const bluetoothModels = {
211
211
  '0': 'MAG ELA (Door Sensor)'
212
212
  },
213
213
  '12': {
214
- '0': 'MLD BLE TPMS (ATP100/ATP102)'
214
+ '0': 'ATP100/ATP102'
215
215
  },
216
216
  '13': {
217
217
  '0': 'WRL300 (Bluetooth Relay)'
@@ -431,12 +431,46 @@ const getTempInCelciousDegrees = hexTemp => {
431
431
  }
432
432
 
433
433
  /*
434
- Gets the temperature and humidity from bluetooth device
434
+ Gets the temperature from BLE devices in celcious degrees
435
435
  */
436
- const getBtTempHumData = hexTemp => {
437
- var int = parseInt(hexTemp.substring(0, 2), 16)
438
- var dec = parseInt(hexTemp.substring(2, 4), 16)
439
- return int + dec / 256
436
+ const getBleTempInCelciousDegrees = (device, hexData) => {
437
+ if (device === 'WTH300') {
438
+ let intTemp = parseInt(hexData.substring(0, 2), 16)
439
+ let decTemp = parseInt(hexData.substring(2, 4), 16)
440
+ return intTemp + decTemp / 256
441
+ } else if (['WTH301', 'WMS301'].includes(device)) {
442
+ let intTemp = parseInt(hexData.substring(0, 2), 16)
443
+ let decTemp = parseInt(hexData.substring(2, 4), 16)
444
+ return intTemp + decTemp / 100
445
+ } else if (device === 'ATP100/ATP102') {
446
+ let temp = parseInt(hexData.substring(4, 6), 16)
447
+ return temp - 40
448
+ } else {
449
+ return null
450
+ }
451
+ }
452
+
453
+ /*
454
+ Gets the humidity from BLE devices in rh
455
+ */
456
+ const getBleHumidityInRH = (device, hexData) => {
457
+ let intHum = parseInt(hexData.substring(4, 6), 16)
458
+ let decHum = parseInt(hexData.substring(6, 8), 16)
459
+ if (device === 'WTH300') {
460
+ return intHum + decHum / 256
461
+ } else if (['WTH301', 'WMS301'].includes(device)) {
462
+ return intHum + decHum / 100
463
+ } else {
464
+ return null
465
+ }
466
+ }
467
+
468
+ /*
469
+ Gets the humidity from BLE devices in rh
470
+ */
471
+ const getTirePressureInPSI = hexData => {
472
+ let tirePress = parseInt(hexData.substring(2, 4), 16) * 2.5 // In kPa
473
+ return tirePress / 6.895 // In PSI
440
474
  }
441
475
 
442
476
  /*
@@ -924,14 +958,17 @@ const getBleData = (parsedData, btIndex) => {
924
958
  ? magIx + 3 : magIx + parseInt(appendMask[2])
925
959
  let relIx = aBatpIx + parseInt(appendMask[1])
926
960
 
961
+ let bleType = bluetoothAccessories[parsedData[cnt + 1]]
962
+ let bleModel = parsedData[cnt + 2] !== ''
963
+ ? bluetoothModels[parsedData[cnt + 1]][parsedData[cnt + 2]]
964
+ : null
965
+ let rawAppendMask = parsedData[cnt + 4]
966
+
927
967
  btDevices.push({
928
968
  index: parsedData[cnt],
929
- type: bluetoothAccessories[parsedData[cnt + 1]],
930
- model:
931
- parsedData[cnt + 2] !== ''
932
- ? bluetoothModels[parsedData[cnt + 1]][parsedData[cnt + 2]]
933
- : null,
934
- appendMask: parsedData[cnt + 4],
969
+ type: bleType,
970
+ model: bleModel,
971
+ appendMask: rawAppendMask,
935
972
  name:
936
973
  parsedData[aNameIx] !== '' && appendMask[15] === '1'
937
974
  ? parsedData[aNameIx]
@@ -953,7 +990,15 @@ const getBleData = (parsedData, btIndex) => {
953
990
  ? parseFloat(parsedData[aBatpIx])
954
991
  : null,
955
992
  accessoryData: {
956
- rawData: parsedData[cnt + 3] !== '' ? parsedData[cnt + 3] : null,
993
+ data: parsedData[cnt + 3] !== '' ? {
994
+ raw: parsedData[cnt + 3],
995
+ temperature: getBleTempInCelciousDegrees(bleModel, parsedData[cnt + 3]),
996
+ humidity: getBleHumidityInRH(bleModel, parsedData[cnt + 3]),
997
+ relayState: bleModel === 'WRL300' ? parseInt(parsedData[cnt + 3]) === 1 ? 'Connected' : 'Disconnected' : null,
998
+ tirePresure: getTirePressureInPSI(parsedData[cnt + 3]),
999
+ productModel: bleModel === 'ATP100/ATP102' ? parsedData[cnt + 3].substring(6, 7) : null,
1000
+ fwVersion: bleModel === 'ATP100/ATP102' ? parsedData[cnt + 3].substring(7, 8) : null,
1001
+ } : null,
957
1002
  temperature:
958
1003
  parsedData[aTmpIx] !== '' && appendMask[11] === '1'
959
1004
  ? parseInt(parsedData[aTmpIx])
@@ -980,7 +1025,7 @@ const getBleData = (parsedData, btIndex) => {
980
1025
  : null,
981
1026
  tirePresure:
982
1027
  parsedData[pressIx] !== '' && appendMask[6] === '1'
983
- ? parseInt(parsedData[pressIx])
1028
+ ? parseInt(parsedData[pressIx]) / 6.895
984
1029
  : null,
985
1030
  timestamp:
986
1031
  parsedData[timeIx] !== '' && appendMask[5] === '1'
@@ -1762,7 +1807,6 @@ module.exports = {
1762
1807
  includeGnnsAccuracy: includeGnnsAccuracy,
1763
1808
  getAccelerationMagnitude: getAccelerationMagnitude,
1764
1809
  getTempInCelciousDegrees: getTempInCelciousDegrees,
1765
- getBtTempHumData: getBtTempHumData,
1766
1810
  getFuelConsumption: getFuelConsumption,
1767
1811
  getHoursForHourmeter: getHoursForHourmeter,
1768
1812
  getSignalStrength: getSignalStrength,