diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index f0a1edb6..318390b6 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -34,6 +34,7 @@ module.exports = { sidebarDepth: 1, // optional, defaults to 1 children: [ 'devices/BM_V23', + 'devices/BPARASITE', 'devices/CGD1', 'devices/CGP1W', 'devices/GAEN', diff --git a/docs/devices/BPARASITE.md b/docs/devices/BPARASITE.md new file mode 100644 index 00000000..795f957a --- /dev/null +++ b/docs/devices/BPARASITE.md @@ -0,0 +1,12 @@ +# rbaron b-parasite + +|Model Id|[BPv1.0-1.2](https://github.com/theengs/decoder/blob/development/src/devices/BPARASITE_json.h)| +|-|-| +|Brand|rbaron| +|Model|b-parasite| +|Short Description|Open hardware and open source soil moisture and ambient temperature/humidity/light sensor https://github.com/rbaron/b-parasite| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power source|CR2032| +|Exchanged data|moisture, temperature, humidity, luminance (v1.1.0+), voltage| +|Encrypted|No| diff --git a/src/decoder.h b/src/decoder.h index 31c85ba2..1a72592b 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -87,6 +87,7 @@ class TheengsDecoder { MS_CDP, GAEN, HHCCPOT002, + BPARASITE, BLE_ID_MAX }; diff --git a/src/devices.h b/src/devices.h index c6d360ce..b002d3ee 100644 --- a/src/devices.h +++ b/src/devices.h @@ -59,6 +59,7 @@ #include "devices/iBeacon_json.h" #include "devices/iNode_json.h" #include "devices/BM_V23_json.h" +#include "devices/BPARASITE_json.h" const char* _devices[][2] = { {_HHCCJCY01HHCC_json, _HHCCJCY01HHCC_json_props}, @@ -102,4 +103,5 @@ const char* _devices[][2] = { {_MS_CDP_json, _MS_CDP_json_props}, {_GAEN_json, _GAEN_json_props}, {_HHCCPOT002_json, _HHCCPOT002_json_props}, + {_BPARASITE_json, _BPARASITE_json_props}, }; diff --git a/src/devices/BPARASITE_json.h b/src/devices/BPARASITE_json.h new file mode 100644 index 00000000..903b97ea --- /dev/null +++ b/src/devices/BPARASITE_json.h @@ -0,0 +1,64 @@ +const char* _BPARASITE_json = "{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"condition\":[\"servicedata\",\">=\",32,\"index\",0,\"1\",\"|\",\"servicedata\",\">=\",32,\"index\",0,\"2\",\"&\",\"uuid\",\"index\",0,\"181a\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",0,\"1\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,4,false,true],\"post_proc\":[\"/\",1000]},\"_tempc\":{\"condition\":[\"servicedata\",0,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,4,false,true],\"post_proc\":[\"/\",100]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,false,false],\"post_proc\":[\"/\",655.35]},\"moi\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",16,4,false,false],\"post_proc\":[\"/\",655.35]},\"lux\":{\"condition\":[\"servicedata\",1,\"bit\",0,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",32,4,false,false]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,4,false,false],\"post_proc\":[\"/\",1000]}}}"; + +/* R""""( +{ + "brand":"rbaron", + "model":"b-parasite", + "model_id":"BPv1.0-1.2", + "condition":["servicedata", ">=", 32, "index", 0, "1", "|", "servicedata", ">=", 32, "index", 0, "2", "&", "uuid", "index", 0, "181a"], + "properties":{ + "tempc":{ + "condition":["servicedata", 0, "1"], + "decoder":["value_from_hex_data", "servicedata", 8, 4, false, true], + "post_proc":["/", 1000] + }, + "_tempc":{ + "condition":["servicedata", 0, "2"], + "decoder":["value_from_hex_data", "servicedata", 8, 4, false, true], + "post_proc":["/", 100] + }, + "hum":{ + "decoder":["value_from_hex_data", "servicedata", 12, 4, false, false], + "post_proc":["/", 655.35] + }, + "moi":{ + "decoder":["value_from_hex_data", "servicedata", 16, 4, false, false], + "post_proc":["/", 655.35] + }, + "lux":{ + "condition":["servicedata", 1, "bit", 0, 1], + "decoder":["value_from_hex_data", "servicedata", 32, 4, false, false] + }, + "volt":{ + "decoder":["value_from_hex_data", "servicedata", 4, 4, false, false], + "post_proc":["/", 1000] + } + } +})"""";*/ + +const char* _BPARASITE_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"hum\":{\"unit\":\"%\",\"name\":\"humidity\"},\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"},\"lux\":{\"unit\":\"lx\",\"name\":\"illuminance\"},\"volt\":{\"unit\":\"V\",\"name\":\"voltage\"}}}"; +/*R""""( +{ + "properties":{ + "tempc":{ + "unit":"°C", + "name":"temperature" + }, + "hum":{ + "unit":"%", + "name":"humidity" + }, + "moi":{ + "unit":"%", + "name":"moisture" + }, + "lux":{ + "unit":"lx", + "name":"illuminance" + }, + "volt":{ + "unit":"V", + "name":"voltage" + } + } +})"""";*/ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index e68aecb3..837e1f21 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -121,6 +121,10 @@ const char* expected_uuid[] = { "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":25.8,\"tempf\":78.44,\"hum\":59,\"batt\":58}", "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":-25.3,\"tempf\":-13.54,\"hum\":56,\"batt\":58}", "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":26,\"tempf\":78.8,\"hum\":56,\"batt\":58}", + "{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":25.6,\"tempf\":78.08,\"hum\":90.00076295,\"moi\":49.99923705,\"volt\":3.1}", + "{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":22.7,\"tempf\":72.86,\"hum\":65.00038148,\"moi\":42.00045777,\"lux\":12500,\"volt\":2.95}", + "{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":25.6,\"tempf\":78.08,\"hum\":90.00076295,\"moi\":49.99923705,\"volt\":3.1}", + "{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":22.7,\"tempf\":72.86,\"hum\":65.00038148,\"moi\":42.00045777,\"lux\":12500,\"volt\":2.95}", }; // Service data test input [test name] [data] @@ -330,6 +334,10 @@ const char* test_uuid[][4] = { {"Switchbot_Meter", "fd3d", "servicedata", "6900ba08993b"}, {"Switchbot_Meter", "fd3d", "servicedata", "6900ba031938"}, {"Switchbot_Meter", "fd3d", "servicedata", "6900ba009ab8"}, + {"bParasite", "181a", "servicedata", "10c30c1c6400e6667fffaabbccddeeff"}, + {"bParasite", "181a", "servicedata", "11c30b8658aca6666b85aabbccddeeff30d4"}, + {"bParasite", "181a", "servicedata", "20c30c1c0a00e6667fffaabbccddeeff"}, + {"bParasite", "181a", "servicedata", "21c30b8608dea6666b85aabbccddeeff30d4"}, }; TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ @@ -363,6 +371,10 @@ TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::SBMT, TheengsDecoder::BLE_ID_NUM::SBMT, TheengsDecoder::BLE_ID_NUM::SBMT, + TheengsDecoder::BLE_ID_NUM::BPARASITE, + TheengsDecoder::BLE_ID_NUM::BPARASITE, + TheengsDecoder::BLE_ID_NUM::BPARASITE, + TheengsDecoder::BLE_ID_NUM::BPARASITE, }; template