correct LYWSD02 not displayed with HM10

#412
This commit is contained in:
Florian committed 2019-06-21 21:51:31 +02:00
1 parent de93fd0da0
commit bc847684f9
1 file changed
+39 -39
+39 -39
View File
@@ -309,45 +309,45 @@ vector<BLEdevice> devices;
BLEdata.set("servicedata", (char *)Service_data.c_str()); BLEdata.set("servicedata", (char *)Service_data.c_str());
#endif #endif
pub((char *)topic.c_str(),BLEdata); pub((char *)topic.c_str(),BLEdata);
if (strcmp(d[4].extract, "fe95") == 0) { int pos = -1;
int pos = -1; pos = strpos(d[5].extract,"209800");
pos = strpos(d[5].extract,"209800"); if (pos != -1) {
if (pos != -1) { trc("mi flora data reading");
trc("mi flora data reading"); #ifdef ZmqttDiscovery
#ifdef ZmqttDiscovery if(!isDiscovered(d[0].extract)) MiFloraDiscovery(d[0].extract);
if(!isDiscovered(d[0].extract)) MiFloraDiscovery(d[0].extract); #endif
#endif boolean result = process_data(pos - 38,(char *)Service_data.c_str(),d[0].extract);
boolean result = process_data(pos - 38,(char *)Service_data.c_str(),d[0].extract); }
} pos = -1;
pos = -1; pos = strpos(d[5].extract,"20aa01");
pos = strpos(d[5].extract,"20aa01"); //example "servicedata":"5020aa0194dfaa33342d580d1004e3002c02"
if (pos != -1){ if (pos != -1){
trc("mi jia data reading"); trc("mi jia data reading");
#ifdef ZmqttDiscovery #ifdef ZmqttDiscovery
if(!isDiscovered(d[0].extract)) MiJiaDiscovery(d[0].extract); if(!isDiscovered(d[0].extract)) MiJiaDiscovery(d[0].extract);
#endif #endif
boolean result = process_data(pos - 40,(char *)Service_data.c_str(),d[0].extract); boolean result = process_data(pos - 40,(char *)Service_data.c_str(),d[0].extract);
} }
pos = -1; pos = -1;
pos = strpos(d[5].extract,"205b04"); pos = strpos(d[5].extract,"205b04");
if (pos != -1){ //example "servicedata":"141695fe70205b0461298882c8593f09061002d002"
trc("LYWSD02 data reading"); if (pos != -1){
#ifdef ZmqttDiscovery trc("LYWSD02 data reading");
if(!isDiscovered(d[0].extract)) LYWSD02Discovery(d[0].extract); #ifdef ZmqttDiscovery
#endif if(!isDiscovered(d[0].extract)) LYWSD02Discovery(d[0].extract);
boolean result = process_data(pos - 38,(char *)Service_data.c_str(),d[0].extract); #endif
} boolean result = process_data(pos - 38,(char *)Service_data.c_str(),d[0].extract);
pos = -1; }
pos = strpos(d[5].extract,"304703"); pos = -1;
if (pos != -1){ pos = strpos(d[5].extract,"304703");
trc("CLEARGRASSTRH data reading"); if (pos != -1){
#ifdef ZmqttDiscovery trc("CLEARGRASSTRH data reading");
if(!isDiscovered(d[0].extract)) CLEARGRASSTRHDiscovery(d[0].extract); #ifdef ZmqttDiscovery
#endif if(!isDiscovered(d[0].extract)) CLEARGRASSTRHDiscovery(d[0].extract);
boolean result = process_data(pos - 40,(char *)Service_data.c_str(),d[0].extract); #endif
} boolean result = process_data(pos - 40,(char *)Service_data.c_str(),d[0].extract);
return true; }
} return true;
} }
} }
} }