Skip to content

Commit 71f74c7

Browse files
authored
TPMS BR initial decoder (#673)
#672 (comment)
1 parent ef36e85 commit 71f74c7

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

docs/devices/YPMSBR.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# TPMS BR for Car/Motorcycle
2+
3+
|Model Id|[TPMSBR](https://github.com/theengs/decoder/blob/development/src/devices/TPMSBR_json.h)|
4+
|-|-|
5+
|Brand|Generic|
6+
|Model|Tire pressure monitoring system|
7+
|Short Description|TPMS that can replace the valve cap|
8+
|Communication|BLE broadcast|
9+
|Frequency|2.4Ghz|
10+
|Power Source|CR1632|
11+
|Exchanged Data|temperature, pressure, voltage|
12+
|Encrypted|No|

src/decoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class TheengsDecoder {
7575
XMTZC05HMKG,
7676
XMTZC05HMLB,
7777
TPMS,
78+
TPMSBR,
7879
KKM_K6P,
7980
KKM_K9,
8081
LYWSD03MMC_ATC,

src/devices.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "devices/Skale_json.h"
7979
#include "devices/SmartDry_json.h"
8080
#include "devices/TPMS_json.h"
81+
#include "devices/TPMSBR_json.h"
8182
#include "devices/KKM_K6P_json.h"
8283
#include "devices/KKM_K9_json.h"
8384
#include "devices/ThermoBeacon_json.h"
@@ -171,6 +172,7 @@ const char* _devices[][2] = {
171172
{_XMTZC05HMKG_json, _XMTZC05HMKG_json_props},
172173
{_XMTZC05HMLB_json, _XMTZC05HMLB_json_props},
173174
{_TPMS_json, _TPMS_json_props},
175+
{_TPMSBR_json, _TPMSBR_json_props},
174176
{_KKM_K6P_json, _KKM_K6P_json_props},
175177
{_KKM_K9_json, _KKM_K9_json_props},
176178
{_LYWSD03MMC_json_ATC, _LYWSD03MMC_json_props},

src/devices/TPMSBR_json.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const char* _TPMSBR_json = "{\"brand\":\"GENERIC\",\"model\":\"BR TPMS\",\"model_id\":\"TPMSBR\",\"tag\":\"0a03\",\"condition\":[\"manufacturerdata\",\"=\",14,\"&\",\"name\",\"index\",0,\"BR\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",4,2,false]},\"pres\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,4,false,false],\"post_proc\":[\"/\",10,\"-\",14.5,\"/\",14.5]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",2,2,false],\"post_proc\":[\"/\",10]}}}";
2+
/*R""""(
3+
{
4+
"brand":"GENERIC",
5+
"model":"BR TPMS",
6+
"model_id":"TPMSBR",
7+
"tag":"0a03",
8+
"condition":["manufacturerdata", "=", 14, "&", "name", "index", 0, "BR"],
9+
"properties":{
10+
"tempc":{
11+
"decoder":["value_from_hex_data", "manufacturerdata", 4, 2, false]
12+
},
13+
"pres":{
14+
"decoder":["value_from_hex_data", "manufacturerdata", 6, 4, false, false],
15+
"post_proc":["/", 10, "-", 14.5, "/", 14.5]
16+
},
17+
"volt":{
18+
"decoder":["value_from_hex_data", "manufacturerdata", 2, 2, false],
19+
"post_proc":["/", 10]
20+
}
21+
}
22+
})"""";*/
23+
24+
const char* _TPMSBR_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"pres\":{\"unit\":\"bar\",\"name\":\"pressure\"},\"volt\":{\"unit\":\"V\",\"name\":\"voltage\"}}}";
25+
/*R""""(
26+
{
27+
"properties":{
28+
"tempc":{
29+
"unit":"°C",
30+
"name":"temperature"
31+
},
32+
"pres":{
33+
"unit":"bar",
34+
"name":"pressure"
35+
},
36+
"volt":{
37+
"unit":"V",
38+
"name":"voltage"
39+
}
40+
}
41+
})"""";*/

tests/BLE/test_ble.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ const char* expected_mfg[] = {
228228
"{\"brand\":\"Govee\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"H5179_N\",\"type\":\"THB\",\"cidc\":false,\"acts\":true,\"tempc\":25.5,\"tempf\":77.9,\"hum\":43,\"batt\":100}",
229229
"{\"brand\":\"Govee\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"H5179_N\",\"type\":\"THB\",\"cidc\":false,\"acts\":true,\"tempc\":28.5,\"tempf\":83.3,\"hum\":6.8,\"batt\":100}",
230230
"{\"brand\":\"Govee\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"H5179_N\",\"type\":\"THB\",\"cidc\":false,\"acts\":true,\"tempc\":22.9,\"tempf\":73.22,\"hum\":56.4,\"batt\":100}",
231+
"{\"brand\":\"GENERIC\",\"model\":\"BR TPMS\",\"model_id\":\"TPMSBR\",\"type\":\"TIRE\",\"cidc\":false,\"acts\":true,\"tempc\":16,\"tempf\":60.8,\"pres\":1.917241379,\"volt\":3}",
232+
"{\"brand\":\"GENERIC\",\"model\":\"BR TPMS\",\"model_id\":\"TPMSBR\",\"type\":\"TIRE\",\"cidc\":false,\"acts\":true,\"tempc\":15,\"tempf\":59,\"pres\":1.917241379,\"volt\":3}",
233+
"{\"brand\":\"GENERIC\",\"model\":\"BR TPMS\",\"model_id\":\"TPMSBR\",\"type\":\"TIRE\",\"cidc\":false,\"acts\":true,\"tempc\":20,\"tempf\":68,\"pres\":1.351724138,\"volt\":3}",
231234
};
232235

233236
const char* expected_name_uuid_mfgsvcdata[] = {
@@ -806,6 +809,9 @@ const char* test_mfgdata[][3] = {
806809
{"H5179", "GV5179_1763", "0100010103e5c664"},
807810
{"H5179", "GV5179_1763", "0100010104598c64"},
808811
{"H5179", "GV5179_1763", "010001010380bc64"},
812+
{"YPMS BR", "BR_1234", "401e1001a79692"},
813+
{"YPMS BR", "BR_1234", "401e0f01a70ffa"},
814+
{"YPMS BR", "BR_1234", "281e1401558536"},
809815
};
810816

811817
TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
@@ -1017,6 +1023,9 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
10171023
TheengsDecoder::BLE_ID_NUM::H5179_N,
10181024
TheengsDecoder::BLE_ID_NUM::H5179_N,
10191025
TheengsDecoder::BLE_ID_NUM::H5179_N,
1026+
TheengsDecoder::BLE_ID_NUM::TPMSBR,
1027+
TheengsDecoder::BLE_ID_NUM::TPMSBR,
1028+
TheengsDecoder::BLE_ID_NUM::TPMSBR,
10201029
};
10211030

10221031
// uuid test input [test name] [device name] [uuid] [manufacturer data] [service data]

0 commit comments

Comments
 (0)