From 25fd485feb5c29aa8a0cdfa61cdc8bdcbdc83e41 Mon Sep 17 00:00:00 2001 From: DigiH Date: Sat, 10 Sep 2022 11:56:34 +0200 Subject: [PATCH] Oria T301 --- docs/.vuepress/config.js | 1 + docs/devices/T301.md | 12 ++++++++++++ src/decoder.h | 1 + src/devices.h | 2 ++ src/devices/T301_json.h | 26 ++++++++++++++++++++++++++ tests/BLE/test_ble.cpp | 9 +++++++++ 6 files changed, 51 insertions(+) create mode 100644 docs/devices/T301.md create mode 100644 src/devices/T301_json.h diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 540617b1..e0c7b4f1 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -61,6 +61,7 @@ module.exports = { 'devices/MS_CDP', 'devices/MokoBeacon', 'devices/MBXPRO', + 'devices/T301', 'devices/CGDK2', 'devices/CGH1', 'devices/CGPR1', diff --git a/docs/devices/T301.md b/docs/devices/T301.md new file mode 100644 index 00000000..d27ac64d --- /dev/null +++ b/docs/devices/T301.md @@ -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| diff --git a/src/decoder.h b/src/decoder.h index 07a0504c..22dfb3a2 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -97,6 +97,7 @@ class TheengsDecoder { ABTEMP, AMPHIRO, TP357, + T301, IBEACON, SERVICE_DATA, BLE_ID_MAX diff --git a/src/devices.h b/src/devices.h index 274c20da..3325e8f1 100644 --- a/src/devices.h +++ b/src/devices.h @@ -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" @@ -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}, }; diff --git a/src/devices/T301_json.h b/src/devices/T301_json.h new file mode 100644 index 00000000..af5e8203 --- /dev/null +++ b/src/devices/T301_json.h @@ -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; diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 9dcde648..9315f68e 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -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[] = { @@ -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[]{ @@ -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]