diff --git a/src/devices/CGDK2_json.h b/src/devices/CGDK2_json.h index 9105a1a0..51269938 100644 --- a/src/devices/CGDK2_json.h +++ b/src/devices/CGDK2_json.h @@ -1,6 +1,6 @@ #include "common_props.h" -const char* _CGDK2_json_STOCK = "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"tag\":\"01\",\"condition\":[\"servicedata\",\"=\",34,\"index\",2,\"10\",\"&\",\"uuid\",\"index\",0,\"fdcd\"],\"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]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"servicedata\",4]}}}"; +const char* _CGDK2_json_STOCK = "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"tag\":\"01\",\"condition\":[\"servicedata\",\"=\",34,\"index\",2,\"10\",\"&\",\"uuid\",\"index\",0,\"fdcd\"],\"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]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",32,2,false]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"servicedata\",4]}}}"; /*R""""( { "brand":"Qingping", @@ -17,6 +17,9 @@ const char* _CGDK2_json_STOCK = "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\ "decoder":["value_from_hex_data", "servicedata", 24, 4, true, false], "post_proc":["/", 10] }, + "batt":{ + "decoder":["value_from_hex_data", "servicedata", 32, 2, false] + }, "mac":{ "decoder":["revmac_from_hex_data", "servicedata", 4] } diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 5399c769..dd5224b5 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -402,9 +402,9 @@ const char* expected_uuid[] = { "{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Weather Station\",\"model_id\":\"CGP1W\",\"type\":\"THBX\",\"tempc\":26.4,\"tempf\":79.52,\"hum\":64.7,\"pres\":1006.3,\"batt\":92,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", "{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Weather Station\",\"model_id\":\"CGP1W\",\"type\":\"THBX\",\"tempc\":27.1,\"tempf\":80.78,\"hum\":64.8,\"pres\":1006.3,\"batt\":92,\"mac\":\"58:2D:34:40:01:4C\"}", "{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Weather Station\",\"model_id\":\"CGP1W\",\"type\":\"THBX\",\"tempc\":25.2,\"tempf\":77.36,\"hum\":58.6,\"pres\":1008.6,\"batt\":32,\"mac\":\"58:2D:34:40:01:4C\"}", - "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"type\":\"THB\",\"tempc\":23.2,\"tempf\":73.76,\"hum\":91.1,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", - "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"type\":\"THB\",\"tempc\":23.3,\"tempf\":73.94,\"hum\":54.1,\"mac\":\"58:2D:34:11:91:79\"}", - "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"type\":\"THB\",\"tempc\":23.3,\"tempf\":73.94,\"hum\":54.1,\"mac\":\"58:2D:34:11:91:79\"}", + "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"type\":\"THB\",\"tempc\":23.2,\"tempf\":73.76,\"hum\":91.1,\"batt\":77,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", + "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"type\":\"THB\",\"tempc\":23.3,\"tempf\":73.94,\"hum\":54.1,\"batt\":77,\"mac\":\"58:2D:34:11:91:79\"}", + "{\"brand\":\"Qingping\",\"model\":\"TH Lite\",\"model_id\":\"CGDK2\",\"type\":\"THB\",\"tempc\":23.3,\"tempf\":73.94,\"hum\":54.1,\"batt\":77,\"mac\":\"58:2D:34:11:91:79\"}", "{\"brand\":\"Qingping\",\"model\":\"Motion & Light\",\"model_id\":\"CGPR1\",\"type\":\"CTMO\",\"cont\":true,\"lux\":0,\"batt\":83,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", "{\"brand\":\"Qingping\",\"model\":\"Motion & Light\",\"model_id\":\"CGPR1\",\"type\":\"CTMO\",\"cont\":true,\"lux\":517,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", "{\"brand\":\"Qingping\",\"model\":\"Motion & Light\",\"model_id\":\"CGPR1\",\"type\":\"CTMO\",\"cont\":true,\"lux\":3,\"motion\":true,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", @@ -1243,9 +1243,9 @@ const char* test_uuid[][4] = { {"ClearGrass Weather Station", "0xfdcd", "servicedata", "0809ffeeddccbbaa01040801870207024f2702015c"}, {"ClearGrass Weather Station", "0xfdcd", "servicedata", "08094c0140342d5801040f01880207024f2702015c"}, {"ClearGrass Weather Station", "0xfdcd", "servicedata", "08094c0140342d580104fc004a0207026627020120"}, - {"Qingping TH lite", "0xfdcd", "servicedata", "8810ffeeddccbbaa0104e8008f0302010b"}, - {"Qingping TH lite", "0xfdcd", "servicedata", "8810799111342d580104e9001d0202010b"}, - {"Qingping TH lite", "0xfdcd", "servicedata", "0810799111342d580104e9001d0202010b"}, + {"Qingping TH lite", "0xfdcd", "servicedata", "8810ffeeddccbbaa0104e8008f0302014d"}, + {"Qingping TH lite", "0xfdcd", "servicedata", "8810799111342d580104e9001d0202014d"}, + {"Qingping TH lite", "0xfdcd", "servicedata", "0810799111342d580104e9001d0202014d"}, {"Qingping Motion & Light", "0xfdcd", "servicedata", "0812ffeeddccbbaa0201530f0118090400000000"}, {"Qingping Motion & Light", "0xfdcd", "servicedata", "8812ffeeddccbbaa0201640f01c4090405020000"}, {"Qingping Motion & Light", "0xfdcd", "servicedata", "4812ffeeddccbbaa0804010300000f0150"},