2024-09-2401

This commit is contained in:
hans-jurgen 2024-09-24 23:29:12 +02:00
parent 8994baad3c
commit 68e1241260
2 changed files with 5 additions and 7 deletions

View File

@ -22,6 +22,8 @@ lib_deps =
[env:debug] ; Entwicklungssystem
build_flags = ${env.build_flags}
-DTRANSPONDER=\"96:33:bb:bf:ff:ab\"
-DORT=\"Wohnung\"
-DDEBUG=0
-DNOADS=0
-DNAME=\"BLE-Praesenz\"

View File

@ -22,7 +22,7 @@ PubSubClient client(espClient);
#define mqtt_port 1883
//cf:d7:ab:1f:24:2c
String Adresse = "96:33:bb:bf:ff:ab"; // Bluetooth Adresse die zu Anwesenheitserkennung überwacht wird ET585
String Adresse = TRANSPONDER; // Bluetooth Adresse die zu Anwesenheitserkennung überwacht wird ET585
//String Adresse = "cf:d7:ab:1f:24:2c"; // Bluetooth Adresse die zu Anwesenheitserkennung überwacht wird Holy-IOT
const int RelaisPin = LED_BUILTIN; // Pin an dem Relais hängt
int Verzoegerung = 30; // Auschaltverzögerung wenn das Signal von BLE ibeacon fehlt
@ -155,10 +155,6 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks
Serial.print(" ");
digitalWrite (RelaisPin, HIGH); // Relais Einschalten
VerzoegerungZaeler = 0; // Ausschaltverzögerung zurücksetzen
/* sprintf(topic, "%s%s%s", "hjk/devices/", "Wohnung", "/telemetry/status" );
client.publish(topic, "DA", true);
Serial.println();
Serial.print(topic); Serial.println(" DA"); */
advertisedDevice.getScan()->stop(); // Scanvorgang beenden
gefunden = true;
} // Found our server
@ -202,12 +198,12 @@ void loop()
client.loop();
pBLEScan->start(scanTime);
if (gefunden == true){
sprintf(topic, "%s%s%s", "hjk/devices/", "Wohnung", "/telemetry/status" );
sprintf(topic, "%s%s%s", "hjk/devices/", ORT, "/telemetry/status" );
client.publish(topic, "DA", true);
Serial.println();
Serial.print(topic); Serial.println(" DA");
} else {
sprintf(topic, "%s%s%s", "hjk/devices/", "Wohnung", "/telemetry/status" );
sprintf(topic, "%s%s%s", "hjk/devices/", ORT, "/telemetry/status" );
client.publish(topic, "FERN", true);
Serial.println();
Serial.print(topic); Serial.println(" FERN");