Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/devices/CGP22C.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ClearGrass/Qingping Thermo-Hygrometer CO2 Detector CGP22C

|Model Id|[CGP22C](https://github.com/theengs/decoder/blob/development/src/devices/CGP22C_json.h)|
|-|-|
|Brand|ClearGrass/Qingping|
|Model|Thermo-Hygrometer CO2 Detector|
|Short Description|Rechargeable temperature, humidity and carbon dioxide sensor|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|Internal battery/USB-C|
|Exchanged Data|temperature, humidity, carbon dioxide, battery|
|Encrypted|No|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class TheengsDecoder {
LYWSD02,
LYWSDCGQ,
CGP1W,
CGP22C,
CGP23W,
CGG1_STOCK,
CGG1_ATC1441,
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "devices/CGDN1_json.h"
#include "devices/CGH1_json.h"
#include "devices/CGP1W_json.h"
#include "devices/CGP22C_json.h"
#include "devices/CGP23W_json.h"
#include "devices/CGPR1_json.h"
#include "devices/ECOFLOW_ADV_json.h"
Expand Down Expand Up @@ -143,6 +144,7 @@ const char* _devices[][2] = {
{_LYWSD02_json, _LYWSD02_json_props},
{_LYWSDCGQ_json, _LYWSDCGQ_json_props},
{_CGP1W_json, _CGP1W_json_props},
{_CGP22C_json, _CGP22C_json_props},
{_CGP23W_json, _CGP23W_json_props},
{_CGG1_json_STOCK, _CGG1_json_props},
{_CGG1_json_ATC1441, _CGG1_json_props},
Expand Down
56 changes: 56 additions & 0 deletions src/devices/CGP22C_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const char* _CGP22C_json = "{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Thermo-Hygrometer CO2 Detector\",\"model_id\":\"CGP22C\",\"tag\":\"0f\",\"condition\":[\"servicedata\",\"=\",42,\"index\",2,\"5d\",\"&\",\"uuid\",\"index\",0,\"fdcd\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,true,true],\"post_proc\":[\"/\",10]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,4,true,false],\"post_proc\":[\"/\",10]},\"co2\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",38,4,true,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",32,2,false,false],\"post_proc\":[\"&\",127]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"servicedata\",4]}}}";
/*R""""(
{
"brand":"ClearGrass/Qingping",
"model":"Thermo-Hygrometer CO2 Detector",
"model_id":"CGP22C",
"tag":"0f",
"condition":["servicedata", "=", 42, "index", 2, "5d", "&", "uuid", "index", 0, "fdcd"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "servicedata", 20, 4, true, true],
"post_proc":["/", 10]
},
"hum":{
"decoder":["value_from_hex_data", "servicedata", 24, 4, true, false],
"post_proc":["/", 10]
},
"co2":{
"decoder":["value_from_hex_data", "servicedata", 38, 4, true, false]
},
"batt":{
"decoder":["value_from_hex_data", "servicedata", 32, 2, false, false],
"post_proc":["&", 127]
},
"mac":{
"decoder":["revmac_from_hex_data", "servicedata", 4]
}
}
})"""";*/

const char* _CGP22C_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"hum\":{\"unit\":\"%\",\"name\":\"humidity\"},\"co2\":{\"unit\":\"ppm\",\"name\":\"carbon_dioxide\"},\"batt\":{\"unit\":\"%\",\"name\":\"battery\"},\"mac\":{\"unit\":\"string\",\"name\":\"MAC address\"}}}";
/*R""""(
{
"properties":{
"tempc":{
"unit":"°C",
"name":"temperature"
},
"hum":{
"unit":"%",
"name":"humidity"
},
"co2":{
"unit":"ppm",
"name":"carbon_dioxide"
},
"batt":{
"unit":"%",
"name":"battery"
},
"mac":{
"unit":"string",
"name":"MAC address"
}
}
})"""";*/
3 changes: 3 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ const char* expected_uuid[] = {
"{\"brand\":\"Feasycom\",\"model\":\"Beacon\",\"model_id\":\"FEASY\",\"type\":\"BCON\",\"track\":true,\"beaconmodel\":\"BP108\",\"batt\":100,\"plugged-in\":false,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"Feasycom\",\"model\":\"Beacon\",\"model_id\":\"FEASY\",\"type\":\"BCON\",\"track\":true,\"beaconmodel\":\"BP103B\",\"batt\":100,\"plugged-in\":false,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"type\":\"ACEL\",\"track\":true,\"tempc\":21.25,\"tempf\":70.25,\"accx\":4,\"accy\":-12,\"accz\":-4,\"volt\":3.05}",
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Thermo-Hygrometer CO2 Detector\",\"model_id\":\"CGP22C\",\"type\":\"AIR\",\"tempc\":25.5,\"tempf\":77.9,\"hum\":43.1,\"co2\":583,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
};

const char* expected_mac_mfg[] = {
Expand Down Expand Up @@ -1430,6 +1431,7 @@ const char* test_uuid[][4] = {
{"Feasycom BP108", "0xfff0", "servicedata", "27021992aabbccddeeff64"},
{"Feasycom BPXXX", "0xfff0", "servicedata", "29021992aabbccddeeff64"},
{"BlueCharm BC04P", "0xfeaa", "servicedata", "21000b0bea15400004fff4fffc"},
{"ClearGrass CO2 Detector", "0xfdcd", "servicedata", "0a5dffeeddccbbaa0104ff00af0102016413024702"},
};

TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
Expand Down Expand Up @@ -1567,6 +1569,7 @@ TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
TheengsDecoder::BLE_ID_NUM::FEASY,
TheengsDecoder::BLE_ID_NUM::FEASY,
TheengsDecoder::BLE_ID_NUM::BC08,
TheengsDecoder::BLE_ID_NUM::CGP22C,
};

// MAC manufacturer data test input [test name] [mac] [data]
Expand Down