Skip to content

Commit

Permalink
Update CGDK2_json.h (theengs#602)
Browse files Browse the repository at this point in the history
* Update CGDK2_json.h

Correct 'name' for PVVX firmware

* Update test_ble.cpp for CDGK2_PVVX
  • Loading branch information
delboy711 authored Jan 20, 2025
1 parent 563f1c1 commit 910f4e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/devices/CGDK2_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ const char* _CGDK2_json_ATC1441 = "{\"brand\":\"ClearGrass/Qingping\",\"model\":
})"""";*/

// PVVX
const char* _CGDK2_json_PVVX = "{\"brand\":\"ClearGrass/Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2_PVVX\",\"tag\":\"0102\",\"condition\":[\"servicedata\",\"=\",30,\"&\",\"uuid\",\"index\",0,\"181a\",\"&\",\"name\",\"index\",0,\"CGDK\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,true],\"post_proc\":[\"/\",100]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",16,4,true],\"post_proc\":[\"/\",100]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,2,false]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,true],\"post_proc\":[\"/\",1000]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"servicedata\",0]}}}";
const char* _CGDK2_json_PVVX = "{\"brand\":\"ClearGrass/Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2_PVVX\",\"tag\":\"0102\",\"condition\":[\"servicedata\",\"=\",30,\"&\",\"uuid\",\"index\",0,\"181a\",\"&\",\"name\",\"index\",0,\"CGD\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,true],\"post_proc\":[\"/\",100]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",16,4,true],\"post_proc\":[\"/\",100]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,2,false]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,true],\"post_proc\":[\"/\",1000]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"servicedata\",0]}}}";
/* R""""(
{
"brand":"ClearGrass/Qingping",
"model":"TH Lite",
"model_id":"CGDK2_PVVX",
"tag":"0102",
"condition":["servicedata", "=", 30, "&", "uuid", "index", 0, "181a", "&", "name", "index", 0, "CGDK"],
"condition":["servicedata", "=", 30, "&", "uuid", "index", 0, "181a", "&", "name", "index", 0, "CGD"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "servicedata", 12, 4, true],
Expand Down
3 changes: 3 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ const char* expected_uuid_name_svcdata[] = {
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Round TH\",\"model_id\":\"CGG1\",\"type\":\"THB\",\"acts\":true,\"hum\":49.4,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Round TH\",\"model_id\":\"CGG1\",\"type\":\"THB\",\"acts\":true,\"batt\":11,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2_PVVX\",\"type\":\"THB\",\"acts\":true,\"tempc\":22.96,\"tempf\":73.328,\"hum\":43.58,\"batt\":100,\"volt\":2.962,\"mac\":\"2D:34:12:1E:E5:FF\"}",
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2_PVVX\",\"type\":\"THB\",\"acts\":true,\"tempc\":20.4,\"tempf\":68.72,\"hum\":54.82,\"batt\":95,\"volt\":2.961,\"mac\":\"58:2D:34:82:B5:FA\"}",
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2_ATC1441\",\"type\":\"THB\",\"acts\":true,\"tempc\":23,\"tempf\":73.4,\"hum\":43,\"batt\":100,\"volt\":2.929,\"mac\":\"2D:34:12:1E:E5:FF\"}",
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_ATC\",\"type\":\"THB\",\"tempc\":32.5,\"tempf\":90.5,\"hum\":62,\"batt\":81,\"volt\":2.939,\"mac\":\"A4:C1:38:D5:D4:98\"}",
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_ATC\",\"type\":\"THB\",\"tempc\":-4.5,\"tempf\":23.9,\"hum\":62,\"batt\":81,\"volt\":2.939,\"mac\":\"A4:C1:38:D5:D4:98\"}",
Expand Down Expand Up @@ -1010,6 +1011,7 @@ const char* test_uuid_name_svcdata[][4] = {
{"ClearGrass round sensor Mi v4", "0xfe95", "ClearGrass Temp & RH", "503047036affeeddccbbaa061002ee01"},
{"ClearGrass round sensor Mi v4", "0xfe95", "ClearGrass Temp & RH", "5030470348ffeeddccbbaa0a10010b"},
{"Qingping TH Lite sensor PVVX", "0x181a", "CGDK2_1233DC", "ffe51e12342df8080611920b649905"},
{"Qingping TH Lite sensor PVVX", "0x181a", "CGD_82B5FA", "fab582342d58f8076a15910b5f3e0e"},
{"Qingping TH Lite sensor ATC1441", "0x181a", "CGDK2_1233DC", "2d34121ee5ff00e62b640b71c0"},
{"LYWSD03MMC_ATC", "0x181a", "ATC_800021", "a4c138d5d49801453e510b7b62"},
{"LYWSD03MMC_ATC", "0x181a", "ATC_800021", "a4c138d5d498ffd33e510b7b62"},
Expand Down Expand Up @@ -1104,6 +1106,7 @@ TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::CGG1_STOCK_2,
TheengsDecoder::BLE_ID_NUM::CGG1_STOCK_2,
TheengsDecoder::BLE_ID_NUM::CGDK2_PVVX,
TheengsDecoder::BLE_ID_NUM::CGDK2_PVVX,
TheengsDecoder::BLE_ID_NUM::CGDK2_ATC1441,
TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_ATC,
TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_ATC,
Expand Down

0 comments on commit 910f4e0

Please sign in to comment.