From cca6e420ab4ec777e4f6ae9be82bf0f4f80b38fc Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 19 Dec 2023 14:21:37 +0100 Subject: [PATCH] =?UTF-8?q?Aranet4=20CO=E2=82=82=20Monitor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/devices/Aranet4.md | 12 ++++++++ src/decoder.h | 1 + src/devices.h | 2 ++ src/devices/ARANET4_json.h | 56 ++++++++++++++++++++++++++++++++++++++ tests/BLE/test_ble.cpp | 6 ++++ 5 files changed, 77 insertions(+) create mode 100644 docs/devices/Aranet4.md create mode 100644 src/devices/ARANET4_json.h diff --git a/docs/devices/Aranet4.md b/docs/devices/Aranet4.md new file mode 100644 index 00000000..02ddba80 --- /dev/null +++ b/docs/devices/Aranet4.md @@ -0,0 +1,12 @@ +# Aranet Aranet4 CO₂ Monitor + +|Model Id|[ARANET4](https://github.com/theengs/decoder/blob/development/src/devices/ARANET4_json.h)| +|-|-| +|Brand|Aranet| +|Model|Aranet4 CO₂ Monitor| +|Short Description|Air quality monitor| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power Source|2 AA| +|Exchanged Data|temperature, humidity, pressure, carbon dioxide, battery| +|Encrypted|No - BLE broadcast only working when Bluetooth dip switch set to ON| diff --git a/src/decoder.h b/src/decoder.h index c50310a6..e7ecf9fa 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -104,6 +104,7 @@ class TheengsDecoder { SCD4X, SKALE, SMARTDRY, + ARANET4, BC08, BM1IN1, BM3IN1, diff --git a/src/devices.h b/src/devices.h index b2421f94..b38accd8 100644 --- a/src/devices.h +++ b/src/devices.h @@ -84,6 +84,7 @@ #include "devices/T301_json.h" #include "devices/tracker_json.h" #include "devices/iNodeEM_json.h" +#include "devices/ARANET4_json.h" #include "devices/BC08_json.h" #include "devices/BM1IN1_json.h" #include "devices/BM3IN1_json.h" @@ -168,6 +169,7 @@ const char* _devices[][2] = { {_SCD4X_json, _SCD4X_json_props}, {_Skale_json, _Skale_json_props}, {_SmartDry_json, _SmartDry_json_props}, + {_ARANET4_json, _ARANET4_json_props}, {_BC08_json, _BC08_json_props}, {_BM1IN1_json, _BM1IN1_json_props}, {_BM3IN1_json, _BM3IN1_json_props}, diff --git a/src/devices/ARANET4_json.h b/src/devices/ARANET4_json.h new file mode 100644 index 00000000..822c42c4 --- /dev/null +++ b/src/devices/ARANET4_json.h @@ -0,0 +1,56 @@ +const char* _ARANET4_json = "{\"brand\":\"Aranet\",\"model\":\"Aranet4 CO₂ Monitor\",\"model_id\":\"ARANET4\",\"tag\":\"0f\",\"condition\":[\"manufacturerdata\",\"=\",48,\"index\",0,\"0207\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true,true],\"post_proc\":[\"/\",20]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",32,2,false,false]},\"pres\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true,false],\"post_proc\":[\"/\",10]},\"co2\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",34,2,false,false],\"post_proc\":[\"&\",127]}}}"; +/*R""""( +{ + "brand":"Aranet", + "model":"Aranet4 CO₂ Monitor", + "model_id":"ARANET4", + "tag":"0f", + "condition":["manufacturerdata", "=", 48, "index", 0, "0207"], + "properties":{ + "tempc":{ + "decoder":["value_from_hex_data", "manufacturerdata", 24, 4, true, true], + "post_proc":["/", 20] + }, + "hum":{ + "decoder":["value_from_hex_data", "manufacturerdata", 32, 2, false, false] + }, + "pres":{ + "decoder":["value_from_hex_data", "manufacturerdata", 28, 4, true, false], + "post_proc":["/", 10] + }, + "co2":{ + "decoder":["value_from_hex_data", "manufacturerdata", 20, 4, true, false] + }, + "batt":{ + "decoder":["value_from_hex_data", "manufacturerdata", 34, 2, false, false], + "post_proc":["&", 127] + } + } +})"""";*/ + +const char* _ARANET4_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"hum\":{\"unit\":\"%\",\"name\":\"humidity\"},\"pres\":{\"unit\":\"hPa\",\"name\":\"pressure\"},\"co2\":{\"unit\":\"ppm\",\"name\":\"carbon_dioxide\"},\"batt\":{\"unit\":\"%\",\"name\":\"battery\"}}}"; +/*R""""( +{ + "properties":{ + "tempc":{ + "unit":"°C", + "name":"temperature" + }, + "hum":{ + "unit":"%", + "name":"humidity" + }, + "pres":{ + "unit":"hPa", + "name":"pressure" + }, + "co2":{ + "unit":"ppm", + "name":"carbon_dioxide" + }, + "batt":{ + "unit":"%", + "name":"battery" + } + } +})"""";*/ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index eafa1317..ba1b5ff5 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -135,6 +135,8 @@ const char* expected_mfg[] = { "{\"brand\":\"GENERIC\",\"model\":\"BM6 Battery Monitor\",\"model_id\":\"BM6\",\"type\":\"BATT\",\"track\":true,\"batt\":78,\"device\":\"BM6 Tracker\"}", "{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"state\":\"locked\"}", "{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"state\":\"unlocked\"}", + "{\"brand\":\"Aranet\",\"model\":\"Aranet4 CO₂ Monitor\",\"model_id\":\"ARANET4\",\"type\":\"AIR\",\"tempc\":26,\"tempf\":78.8,\"hum\":19,\"pres\":804,\"co2\":879,\"batt\":98}", + "{\"brand\":\"Aranet\",\"model\":\"Aranet4 CO₂ Monitor\",\"model_id\":\"ARANET4\",\"type\":\"AIR\",\"tempc\":26.3,\"tempf\":79.34,\"hum\":17,\"pres\":803.2,\"co2\":844,\"batt\":98}", }; const char* expected_name_uuid_mfgsvcdata[] = { @@ -512,6 +514,8 @@ const char* test_mfgdata[][3] = { {"BM6", "Battery Monitor", "4c0002153ba29cd9a42c894856badaf2606ef777114e0000cd"}, {"Apple", "Watch", "4c0010050b182068dd"}, {"Apple", "Watch", "4c0010050b982068dd"}, + {"Aranet", "Aranet4", "0207210e0401000c0f016f030802681f1362012c018c00b9"}, + {"Aranet", "Aranet4", "0207210e0401000c0f014c030e02601f1162012c01b10036"}, }; TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ @@ -629,6 +633,8 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::BM6, TheengsDecoder::BLE_ID_NUM::APPLEWATCH, TheengsDecoder::BLE_ID_NUM::APPLEWATCH, + TheengsDecoder::BLE_ID_NUM::ARANET4, + TheengsDecoder::BLE_ID_NUM::ARANET4, }; // uuid test input [test name] [device name] [uuid] [manufacturer data] [service data]