Skip to content

Commit 84eed28

Browse files
authored
Update PersonErkennung_esp32_cam.ino
1 parent 8f2cb5a commit 84eed28

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

libraries/ESP32/examples/Camera/PersonErkennung_esp32_cam/PersonErkennung_esp32_cam.ino

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const char* mqttServer = "ip.from.mqtt.server"; // your MQTT Server
1818
const int mqttPort = 1883; // your MQTT Port
1919
const char* mqttUser = "username"; // your MQTT Username
2020
const char* mqttPassword = "userpassword"; // your MQTT password
21-
const char* espName = "ESP32Cam"; // your espCam Name
22-
const char* inTopic = "ESP32Cam/door/Browser"; // your MQTT phath for activate browser 1/on/true aktivate your browser
23-
const char* msgTopic = "ESP32Cam/door/Erkannt"; // your MQTT phath for facial recognition
24-
const char* wifist = "ESP32Cam/door/wifi"; // your MQTT phath for facial recognition
21+
const char* espName = "1ESP32Cam"; // your espCam Name
22+
const char* inTopic = "1ESP32Cam/door/Browser"; // your MQTT phath for activate browser 1/on/true aktivate your browser
23+
const char* msgTopic = "1ESP32Cam/door/Erkannt"; // your MQTT phath for facial recognition
24+
const char* wifist = "1ESP32Cam/door/wifi"; // your MQTT phath for facial recognition
2525
#define relay_pin 2 // pin 12 can also be used. aktivate your Relais on this pin
26-
long interval = 3000; // open lock for ... milliseconds
26+
long interval = 5000; // open lock for ... milliseconds
2727
String rssii;
2828
//
2929
//
@@ -416,6 +416,11 @@ void interface_active(WebsocketsClient &client) {
416416

417417
while (client.available() && websockets_active) {
418418
client.poll();
419+
while (WiFi.status() != WL_CONNECTED) {
420+
WiFi.begin(ssid, password);
421+
delay(2000);
422+
websockets_active = false;
423+
}
419424

420425
// If the MQTT connection inactively, then we try to set it and to publish/subscribe
421426
if (!mqttClient.connected()) {
@@ -521,6 +526,11 @@ void interface_inactive(WebsocketsClient &client) {
521526
out_res.image = image_matrix->item;
522527
while (!websockets_active) {
523528

529+
while (WiFi.status() != WL_CONNECTED) {
530+
WiFi.begin(ssid, password);
531+
delay(2000);
532+
websockets_active = false;
533+
}
524534
// If the MQTT connection inactively, then we try to set it and to publish/subscribe
525535
if (!mqttClient.connected()) {
526536
if (mqttClient.connect(espName, mqttUser, mqttPassword)) {

0 commit comments

Comments
 (0)