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 67d889f commit 34ed3f7
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 @@ -96,6 +96,7 @@ class TheengsDecoder {
ABN03,
ABTEMP,
AMPHIRO,
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 @@ -64,6 +64,7 @@
#include "devices/ABN03_json.h"
#include "devices/ABTemp_json.h"
#include "devices/Amphiro_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 @@ -122,6 +123,7 @@ const char* _devices[][2] = {
{_ABN03_json, _ABN03_json_props},
{_ABTemp_json, _ABTemp_json_props},
{_AMPHIRO_json, _AMPHIRO_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 @@ -80,6 +80,9 @@ 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\":\"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 @@ -264,6 +267,9 @@ const char* test_mfgdata[][3] = {
{"SmartDry", "Laundry Sensor", "ae01ca9dec4160fc5f424a005206"},
{"ABTemp", "ABTemp", "4c000215b5b182c7eab14988aa99b5c1517008d90001641ac5"},
{"Amphiro", "Digital Hand Shower", "eefa0000240015000015001a0029000c194f000000"},
{"Oria", "T301", "55aa0105aabbccddeeff01070a0015e0630001"},
{"Oria", "T301", "55aa0105aabbccddeeff010709e215e0530001"},
{"Oria", "T301", "55aa0105aabbccddeeff01070a3c170c440001"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -322,6 +328,9 @@ 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::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 34ed3f7

Please sign in to comment.