Skip to content

Commit 5890bf7

Browse files
authored
Fix for CGD1 detection (#810)
Before the fix: {"id":"58:2D:34:50:A0:D0","name":"Qingping Alarm Clock","rssi":-82,"distance":11.4949,"servicedata":"080cd0a050342d580104c0007c02"} The servicedata string does not match any pattern so is not parsed After the fix: {"id":"58:2D:34:50:A0:D0","name":"Qingping Alarm Clock","rssi":-83,"distance":12.61001,"model":"CGD1","tem":19.2,"tempc":19.2,"tempf":66.56,"hum":63.5} The parser is invoked and the data is output as expected. There are probably too many brackets (I'm not a C dev) and I can't test on whatever version of CGD1 broadcasts 080caf or 080c09 servicedata strings.
1 parent a184355 commit 5890bf7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main/ZgatewayBT.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ JsonObject& process_bledata(JsonObject& BLEdata) {
980980
return process_cleargrass(BLEdata, false);
981981
}
982982
Log.trace(F("Is it a CGD1?" CR));
983-
if ((strstr(service_data, "080caf") != NULL || strstr(service_data, "080c09") != NULL) && (strlen(service_data) > ServicedataMinLength)) {
983+
if (((strstr(service_data, "080caf") != NULL || strstr(service_data, "080c09") != NULL) && (strlen(service_data) > ServicedataMinLength)) || (strstr(service_data, "080cd0") != NULL && (strlen(service_data) > ServicedataMinLength - 6))) {
984984
Log.trace(F("CGD1 data reading" CR));
985985
BLEdata.set("model", "CGD1");
986986
if (device->sensorModel == -1)

0 commit comments

Comments
 (0)