Skip to content

Commit

Permalink
Oria T301
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH committed Sep 11, 2022
1 parent aa41e4d commit 25fd485
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module.exports = {
'devices/MS_CDP',
'devices/MokoBeacon',
'devices/MBXPRO',
'devices/T301',
'devices/CGDK2',
'devices/CGH1',
'devices/CGPR1',
Expand Down
12 changes: 12 additions & 0 deletions docs/devices/T301.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Oria/Brifit/SigmaWit/SensorPro T301

|Model Id|[T301](https://github.com/theengs/decoder/blob/development/src/devices/T301_json.h)|
|-|-|
|Brand|Oria/Brifit/SigmaWit/SensorPro|
|Model|TH sensor|
|Short Description|Temperature and humidity sensor|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power source|2 CR2032|
|Exchanged data|temperature, humidity, battery|
|Encrypted|No|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class TheengsDecoder {
ABTEMP,
AMPHIRO,
TP357,
T301,
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 @@ -65,6 +65,7 @@
#include "devices/ABTemp_json.h"
#include "devices/Amphiro_json.h"
#include "devices/TP357_8_json.h"
#include "devices/T301_json.h"
#include "devices/iBeacon_json.h"
#include "devices/iNodeEM_json.h"
#include "devices/BM_V23_json.h"
Expand Down Expand Up @@ -124,6 +125,7 @@ const char* _devices[][2] = {
{_ABTemp_json, _ABTemp_json_props},
{_AMPHIRO_json, _AMPHIRO_json_props},
{_TP357_json, _TP357_json_props},
{_T301_json, _T301_json_props},
{_ibeacon_json, _ibeacon_json_props},
{_ServiceData_json, _ServiceData_json_props},
};
26 changes: 26 additions & 0 deletions src/devices/T301_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "common_props.h"

const char* _T301_json = "{\"brand\":\"Oria\",\"model\":\"TH Sensor\",\"model_id\":\"T301\",\"cidc\":false,\"condition\":[\"name\",\"index\",0,\"T301\",\"&\",\"manufacturerdata\",\"=\",38],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,false,true],\"post_proc\":[\"/\",100]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,false,false],\"post_proc\":[\"/\",100]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",32,2]}}}";
/*R""""(
{
"brand":"Oria",
"model":"TH Sensor",
"model_id":"T301",
"cidc":false,
"condition":["name", "index", 0, "T301", "&","manufacturerdata", "=", 38],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "manufacturerdata", 24, 4, false, true],
"post_proc":["/", 100]
},
"hum":{
"decoder":["value_from_hex_data", "manufacturerdata", 28, 4, false, false],
"post_proc":["/", 100]
},
"batt":{
"decoder":["value_from_hex_data", "manufacturerdata", 32, 2]
}
}
})"""";*/

const char* _T301_json_props = _common_BTH_props;
9 changes: 9 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const char* expected_mfg[] = {
"{\"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}",
"{\"brand\":\"Oria\",\"model\":\"TH Sensor\",\"model_id\":\"T301\",\"cidc\":false,\"tempc\":25.6,\"tempf\":78.08,\"hum\":56,\"batt\":99}",
"{\"brand\":\"Oria\",\"model\":\"TH Sensor\",\"model_id\":\"T301\",\"cidc\":false,\"tempc\":25.3,\"tempf\":77.54,\"hum\":56,\"batt\":83}",
"{\"brand\":\"Oria\",\"model\":\"TH Sensor\",\"model_id\":\"T301\",\"cidc\":false,\"tempc\":26.2,\"tempf\":79.16,\"hum\":59,\"batt\":68}",
};

const char* expected_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -272,6 +275,9 @@ const char* test_mfgdata[][3] = {
{"ThermoPro", "TP357", "c276014a022c"},
{"ThermoPro", "TP358", "c2f50032022c"},
{"ThermoPro", "TP358", "c2f60033022c"},
{"Oria", "T301", "55aa0105aabbccddeeff01070a0015e0630001"},
{"Oria", "T301", "55aa0105aabbccddeeff010709e215e0530001"},
{"Oria", "T301", "55aa0105aabbccddeeff01070a3c170c440001"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -334,6 +340,9 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::TP357,
TheengsDecoder::BLE_ID_NUM::TP357,
TheengsDecoder::BLE_ID_NUM::TP357,
TheengsDecoder::BLE_ID_NUM::T301,
TheengsDecoder::BLE_ID_NUM::T301,
TheengsDecoder::BLE_ID_NUM::T301,
};

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

0 comments on commit 25fd485

Please sign in to comment.