Skip to content

Commit

Permalink
Add CGDK2 cases starting by 0810 (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
1technophile authored May 19, 2022
1 parent 9fdf642 commit 988bc6a
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
@@ -1,12 +1,12 @@
#include "common_props.h"

const char* _CGDK2_json = "{\"brand\":\"Qingping\",\"model\":\"TH lite\",\"model_id\":\"CGDK2\",\"condition\":[\"servicedata\",\"index\",0,\"8810\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,true],\"post_proc\":[\"/\",10]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,4,true,false],\"post_proc\":[\"/\",10]}}}";
const char* _CGDK2_json = "{\"brand\":\"Qingping\",\"model\":\"TH lite\",\"model_id\":\"CGDK2\",\"condition\":[\"servicedata\",\"index\",0,\"8810\",\"|\",\"servicedata\",\"index\",0,\"0810\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,true],\"post_proc\":[\"/\",10]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,4,true,false],\"post_proc\":[\"/\",10]}}}";
/*R""""(
{
"brand":"Qingping",
"model":"TH lite",
"model_id":"CGDK2",
"condition":["servicedata", "index", 0, "8810"],
"condition":["servicedata", "index", 0, "8810","|","servicedata", "index", 0, "0810"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "servicedata", 20, 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 @@ -31,6 +31,7 @@ const char* expected_servicedata[] = {
"{\"brand\":\"Xiaomi\",\"model\":\"CG_alarm_clock\",\"model_id\":\"CGD1\",\"tempc\":27,\"tempf\":80.6,\"hum\":65.7}",
"{\"brand\":\"Qingping\",\"model\":\"TH lite\",\"model_id\":\"CGDK2\",\"tempc\":23.2,\"tempf\":73.76,\"hum\":91.1}",
"{\"brand\":\"Qingping\",\"model\":\"TH lite\",\"model_id\":\"CGDK2\",\"tempc\":23.3,\"tempf\":73.94,\"hum\":54.1}",
"{\"brand\":\"Qingping\",\"model\":\"TH lite\",\"model_id\":\"CGDK2\",\"tempc\":23.3,\"tempf\":73.94,\"hum\":54.1}",
"{\"brand\":\"Qingping\",\"model\":\"Door sensor\",\"model_id\":\"CGH1\",\"open\":true}",
"{\"brand\":\"Qingping\",\"model\":\"Door sensor\",\"model_id\":\"CGH1\",\"open\":false}",
"{\"brand\":\"Qingping\",\"model\":\"Door sensor\",\"model_id\":\"CGH1\",\"open\":true}",
Expand Down Expand Up @@ -147,6 +148,7 @@ const char* test_servicedata[][2] = {
{"Cleargrass alarm clock", "080caffd50342d5801040e01910202012a"},
{"Qingping TH lite", "8810799111342d580104e8008f0302010b"},
{"Qingping TH lite", "8810799111342d580104e9001d0202010b"},
{"Qingping TH lite", "0810799111342d580104e9001d0202010b"},
{"Qingping Door Open", "0804751060342d580201600f012b0f0100"},
{"Qingping Door Close", "0804751060342d580201600f01420f0101"},
{"Qingping Door Open Action", "4804751060342d580401000f01cb"},
Expand Down Expand Up @@ -190,6 +192,7 @@ TheengsDecoder::BLE_ID_NUM test_svcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::CGD1,
TheengsDecoder::BLE_ID_NUM::CGDK2,
TheengsDecoder::BLE_ID_NUM::CGDK2,
TheengsDecoder::BLE_ID_NUM::CGDK2,
TheengsDecoder::BLE_ID_NUM::CGH1,
TheengsDecoder::BLE_ID_NUM::CGH1,
TheengsDecoder::BLE_ID_NUM::CGH1,
Expand Down

0 comments on commit 988bc6a

Please sign in to comment.