fix ESP32 ble (#304)
* remove redundant code for home presence * hopefully fix ESP32 BLE hangs * basic support for duplicate detection when JSON publishing is active
This commit is contained in:
1 parent
ba829e643e
commit
a74eb76931
3 files changed
+19
-6
No files matched your search
@@ -830,9 +830,22 @@ void receivingMQTT(char * topicOri, char * datacallback) {
|
||||
if (strstr(topicOri, subjectMultiGTWKey) != NULL) // storing received value so as to avoid publishing this value if it has been already sent by this or another OpenMQTTGateway
|
||||
{
|
||||
trc(F("Storing signal"));
|
||||
#ifdef jsonPublishing
|
||||
trc(F("Creating Json buffer"));
|
||||
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
|
||||
JsonObject& jsondata = jsonBuffer.parseObject(datacallback);
|
||||
unsigned long data = strtoul(jsondata["value"], NULL, 10); // we will not be able to pass values > 4294967295
|
||||
storeValue(data);
|
||||
trc(F("Data from JSON stored"));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef simplePublishing
|
||||
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
||||
storeValue(data);
|
||||
trc(F("Data stored"));
|
||||
#endif
|
||||
|
||||
}
|
||||
//YELLOW ON
|
||||
digitalWrite(led_send, LOW);
|
||||
|
||||
+5
-5
@@ -74,11 +74,12 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
|
||||
BLEdata.set("txpower", (int8_t) advertisedDevice.getTXPower());
|
||||
}
|
||||
if (advertisedDevice.haveServiceData()){
|
||||
|
||||
|
||||
char mac[mac_adress.length()+1];
|
||||
mac_adress.toCharArray(mac,mac_adress.length()+1);
|
||||
|
||||
trc(F("Get service data "));
|
||||
|
||||
std::string serviceData = advertisedDevice.getServiceData();
|
||||
int serviceDataLength = serviceData.length();
|
||||
String returnedString = "";
|
||||
@@ -98,9 +99,7 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
|
||||
|
||||
BLEdata.set("servicedatauuid", (char *)advertisedDevice.getServiceDataUUID().toString().c_str());
|
||||
|
||||
char topic[] = subjectBTtoMQTT;
|
||||
strcat(topic, mac);
|
||||
pub(topic,BLEdata);
|
||||
pub((char *)mactopic.c_str(),BLEdata);
|
||||
|
||||
if (strstr(BLEdata["servicedatauuid"].as<char*>(),"fe95") != NULL){
|
||||
trc("Processing BLE device data");
|
||||
@@ -116,6 +115,7 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
|
||||
trc("mi jia data reading");
|
||||
boolean result = process_data(pos - 26,service_data,mac);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
|
||||
"coreTask", /* Name of the task */
|
||||
10000, /* Stack size in words */
|
||||
NULL, /* Task input parameter */
|
||||
0, /* Priority of the task */
|
||||
1, /* Priority of the task */
|
||||
NULL, /* Task handle. */
|
||||
taskCore); /* Core where the task should run */
|
||||
trc(F("ZgatewayBT multicore ESP32 setup done "));
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
|
||||
/*-------------------HOME ASSISTANT ROOM PRESENCE ----------------------*/
|
||||
// if not commented Home presence integration with HOME ASSISTANT is activated
|
||||
#define subjectHomePresence Base_Topic "/salon" // will send Home Assistant room presence message to this topic (first part is same for all rooms, second is room name)
|
||||
#define subjectHomePresence Base_Topic "home_presence/" Gateway_Name // will send Home Assistant room presence message to this topic (first part is same for all rooms, second is room name)
|
||||
|
||||
|
||||
struct decompose
|
||||
|
||||
Reference in new issue
Block a user