Skip to content

Commit

Permalink
ThermoPro TP357 & TP358 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Sep 11, 2022
1 parent 67d889f commit aa41e4d
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ module.exports = {
'devices/SBMT',
'devices/SBS1',
'devices/ServiceData',
'devices/TP357',
'devices/TP358',
'devices/TPMS',
'devices/ThermoBeacon',
'devices/HHCCJCY01HHCC',
Expand Down
12 changes: 12 additions & 0 deletions docs/devices/TP357.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ThermoPro TP357

|Model Id|[TP357](https://github.com/theengs/decoder/blob/development/src/devices/TP357_8_json.h)|
|-|-|
|Brand|ThermoPro|
|Model|TH sensor|
|Short Description|Temperature and humidity sensor|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power source|1 AAA|
|Exchanged data|temperature, humidity|
|Encrypted|No|
12 changes: 12 additions & 0 deletions docs/devices/TP358.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ThermoPro TP358

|Model Id|[TP358](https://github.com/theengs/decoder/blob/development/src/devices/TP357_8_json.h)|
|-|-|
|Brand|ThermoPro|
|Model|TH sensor|
|Short Description|Temperature and humidity sensor|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power source|2 AAA|
|Exchanged data|temperature, humidity|
|Encrypted|No|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class TheengsDecoder {
ABN03,
ABTEMP,
AMPHIRO,
TP357,
IBEACON,
SERVICE_DATA,
BLE_ID_MAX
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "devices/ABN03_json.h"
#include "devices/ABTemp_json.h"
#include "devices/Amphiro_json.h"
#include "devices/TP357_8_json.h"
#include "devices/iBeacon_json.h"
#include "devices/iNodeEM_json.h"
#include "devices/BM_V23_json.h"
Expand Down Expand Up @@ -122,6 +123,7 @@ const char* _devices[][2] = {
{_ABN03_json, _ABN03_json_props},
{_ABTemp_json, _ABTemp_json_props},
{_AMPHIRO_json, _AMPHIRO_json_props},
{_TP357_json, _TP357_json_props},
{_ibeacon_json, _ibeacon_json_props},
{_ServiceData_json, _ServiceData_json_props},
};
22 changes: 22 additions & 0 deletions src/devices/TP357_8_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "common_props.h"

const char* _TP357_json = "{\"brand\":\"ThermoPro\",\"model\":\"TH Sensor\",\"model_id\":\"TP357/8\",\"cidc\":false,\"condition\":[\"name\",\"index\",0,\"TP357\",\"|\",\"name\",\"index\",0,\"TP358\",\"&\",\"manufacturerdata\",\"=\",12],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",2,4,true,true],\"post_proc\":[\"/\",10]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,2,false,false]}}}";
/*R""""(
{
"brand":"ThermoPro",
"model":"TH Sensor",
"model_id":"TP357/8",
"cidc":false,
"condition":["name", "index", 0, "TP357", "|", "name", "index", 0, "TP358", "&","manufacturerdata", "=", 12],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "manufacturerdata", 2, 4, true, true],
"post_proc":["/", 10]
},
"hum":{
"decoder":["value_from_hex_data", "manufacturerdata", 6, 2, false, false]
}
}
})"""";*/

const char* _TP357_json_props = _common_TH_props;
12 changes: 12 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ const char* expected_mfg[] = {
"{\"brand\":\"SmartDry\",\"model\":\"Laundry Sensor\",\"model_id\":\"SDLS\",\"cidc\":false,\"tempc\":29.57704544,\"tempf\":85.23868179,\"hum\":55.99645996,\"shake\":false,\"shake_count\":74,\"volt\":2.929,\"wake\":false}",
"{\"brand\":\"April Brother\",\"model\":\"ABTemp\",\"model_id\":\"ABTemp\",\"mfid\":\"4c00\",\"uuid\":\"b5b182c7eab14988aa99b5c1517008d9\",\"major\":1,\"batt\":100,\"tempc\":26,\"tempf\":78.8,\"txpower\":-59}",
"{\"brand\":\"Oras\",\"model\":\"Hydractiva Digital\",\"model_id\":\"ADHS\",\"cidc\":false,\"session\":36,\"seconds\":21,\"litres\":2.6,\"tempc\":41,\"tempf\":105.8,\"energy\":0.12}",
"{\"brand\":\"ThermoPro\",\"model\":\"TH Sensor\",\"model_id\":\"TP357/8\",\"cidc\":false,\"tempc\":27.2,\"tempf\":80.96,\"hum\":71}",
"{\"brand\":\"ThermoPro\",\"model\":\"TH Sensor\",\"model_id\":\"TP357/8\",\"cidc\":false,\"tempc\":37.4,\"tempf\":99.32,\"hum\":74}",
"{\"brand\":\"ThermoPro\",\"model\":\"TH Sensor\",\"model_id\":\"TP357/8\",\"cidc\":false,\"tempc\":24.5,\"tempf\":76.1,\"hum\":50}",
"{\"brand\":\"ThermoPro\",\"model\":\"TH Sensor\",\"model_id\":\"TP357/8\",\"cidc\":false,\"tempc\":24.6,\"tempf\":76.28,\"hum\":51}",
};

const char* expected_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -264,6 +268,10 @@ const char* test_mfgdata[][3] = {
{"SmartDry", "Laundry Sensor", "ae01ca9dec4160fc5f424a005206"},
{"ABTemp", "ABTemp", "4c000215b5b182c7eab14988aa99b5c1517008d90001641ac5"},
{"Amphiro", "Digital Hand Shower", "eefa0000240015000015001a0029000c194f000000"},
{"ThermoPro", "TP357", "c2100147022c"},
{"ThermoPro", "TP357", "c276014a022c"},
{"ThermoPro", "TP358", "c2f50032022c"},
{"ThermoPro", "TP358", "c2f60033022c"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -322,6 +330,10 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::SMARTDRY,
TheengsDecoder::BLE_ID_NUM::ABTEMP,
TheengsDecoder::BLE_ID_NUM::AMPHIRO,
TheengsDecoder::BLE_ID_NUM::TP357,
TheengsDecoder::BLE_ID_NUM::TP357,
TheengsDecoder::BLE_ID_NUM::TP357,
TheengsDecoder::BLE_ID_NUM::TP357,
};

// uuid test input [test name] [uuid] [manufacturer data] [service data]
Expand Down

0 comments on commit aa41e4d

Please sign in to comment.