Skip to content

Commit

Permalink
Aranet4 CO₂ Monitor (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Dec 19, 2023
1 parent 1e7682b commit ca18584
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/devices/Aranet4.md
Original file line number Diff line number Diff line change
@@ -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|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class TheengsDecoder {
SCD4X,
SKALE,
SMARTDRY,
ARANET4,
BC08,
BM1IN1,
BM3IN1,
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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},
Expand Down
56 changes: 56 additions & 0 deletions src/devices/ARANET4_json.h
Original file line number Diff line number Diff line change
@@ -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"
}
}
})"""";*/
6 changes: 6 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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[]{
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit ca18584

Please sign in to comment.