diff --git a/src/bluetooth.cpp b/src/bluetooth.cpp index bf31a4f..2e5c382 100644 --- a/src/bluetooth.cpp +++ b/src/bluetooth.cpp @@ -28,8 +28,7 @@ class BlueTooth: public BLEAdvertisedDeviceCallbacks { String command; long lastRun = 0; long lastClear = 0; - long lastSendDeviceData = 0; - int scanAfter = BT_DEFAULT_SCAN_INTERVAL; + long lastSendDeviceData = 0; boolean sendAutoDiscovery = false; long lastSendAutoDiscovery = 0; @@ -81,7 +80,7 @@ class BlueTooth: public BLEAdvertisedDeviceCallbacks { // Parse the sting, split by ; // Auto discovery for Home Assistant is available. - // Set it tru if the user enabled it + // Set it tre if the user enabled it sendAutoDiscovery = (database.getValueAsInt(DB_HA_AUTODISCOVERY) > 0) ? true : false; if (sendAutoDiscovery) { autoDiscoveryPrefix = database.getValueAsString(DB_HA_AUTODISCOVERY_PREFIX); @@ -97,10 +96,10 @@ class BlueTooth: public BLEAdvertisedDeviceCallbacks { void loop() { - if (millis() - lastRun > scanAfter) { + if (millis() - lastRun > BT_DEFAULT_SCAN_INTERVAL) { // Otherwise makes no sens to scan and sent it over if (networkConnected) { - BLEScanResults foundDevices = pBLEScan->start(5, false); + BLEScanResults foundDevices = pBLEScan->start(10, false); pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory lastRun = millis(); } diff --git a/src/definitions.h b/src/definitions.h index b4a2fed..34731c0 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -26,7 +26,7 @@ #define BT_DEVICE_DATA_INTERVAL 1000*60 // Send the BLE device data time to time #define DEVICE_DROP_OUT_COUNT 2 // We won't drop out in the first "not found" state, just decrease this value. Drop out when this is 0 #define PARSE_CHAR ";" -#define BT_DEFAULT_SCAN_INTERVAL 2000 // Scan is running after this timeout time to time +#define BT_DEFAULT_SCAN_INTERVAL 3000 // Scan is running after this timeout time to time // Webhook #define PRESENCE_WILDCARD "{presence}" diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 5c06716..8e0c63f 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -199,7 +199,7 @@ class Mqtt { } void sendStatus () { - sendMqttMessage(baseTopic, "{\"status\": \"" + statusOn + "\", \"ip\":\"" + this -> deviceIPAddress + "\"}"); + sendMqttMessage(baseTopic, "{\"status\": \"" + statusOn + "\", \"ip\":\"" + this -> deviceIPAddress + "\"}", true); } }; diff --git a/src/webcontent.h b/src/webcontent.h index e7143c5..2bb52e0 100644 --- a/src/webcontent.h +++ b/src/webcontent.h @@ -378,7 +378,7 @@ BLEcker home update -
v1.11 - 134
+
v1.11 - 144
@@ -1550,7 +1550,7 @@ BLEcker home update -
v1.11 - 134
+
v1.11 - 144
diff --git a/src/webhook.cpp b/src/webhook.cpp index 6fd0e86..93a69d7 100644 --- a/src/webhook.cpp +++ b/src/webhook.cpp @@ -11,7 +11,7 @@ class Webhook { Logger logger; Database* database; - HTTPClient http; + HTTPClient http; boolean webhookConfigured = false; unsigned long lastrun = 0; @@ -39,6 +39,7 @@ class Webhook { if (webhookConfigured) { String baseURL = this->database->getValueAsString(DB_WEBHOOK); + baseURL.toLowerCase(); baseURL.replace(DEVICE_WILDCARD, device.mac); if (device.available) { @@ -46,9 +47,10 @@ class Webhook { } else { baseURL.replace(PRESENCE_WILDCARD, getPresentString(*database, false)); } - - http.begin(baseURL); //Specify the URL - int httpCode = http.GET(); //Make the request + + http.begin(baseURL); //Specify the URL + + int httpCode = http.GET(); //Make the request if (httpCode > 0) { //Check for the returning code