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:
animavitis authored and Florian committed 2018-11-09 22:19:02 +01:00
1 parent ba829e643e
commit a74eb76931
3 files changed
+19 -6

No files matched your search

+13
View File
@@ -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);