@@ -195,7 +195,7 @@ String relaise;
195
195
// !!!ALIGN DATA / DATEN ANGLEICHEN !!!
196
196
const char * ssid = " WlanName" ; // your network SSID (name) / Wlan- Name
197
197
const char * password = " WlanPassword" ; // your network password / Wlan Passwort
198
- const char * mqttServer = " ip.from.mqtt.server " ; // your MQTT Server / MQTT Server IP
198
+ const char * mqttServer = " ip_from_mqtt_server " ; // your MQTT Server / MQTT Server IP
199
199
const int mqttPort = 1883 ; // your MQTT Port / MQTT PORT (z.B.1883)
200
200
const char * mqttUser = " username" ; // your MQTT Username / MQTT Benutzername
201
201
const char * mqttPassword = " userpassword" ; // your MQTT password / MQTT Passwort
@@ -417,12 +417,9 @@ void setup() {
417
417
mqttClient.publish (wifist.c_str (), rssii.c_str ()); // MQTT Server ESP32 wifi strength
418
418
mqttClient.publish (wifiip.c_str (), WiFi.localIP ().toString ().c_str ()); // MQTT Server ESP32 IP Number
419
419
mqttClient.publish (inTopic.c_str (), " false" );
420
- mqttClient.subscribe (inTopic.c_str ());
421
420
mqttClient.publish (foto.c_str (), " false" );
422
- mqttClient.subscribe (foto.c_str ());
423
421
mqttClient.publish (relaise.c_str (), " false" );
424
422
mqttClient.publish (opener.c_str (), " false" );
425
- mqttClient.subscribe (opener.c_str ());
426
423
reconnect (); // inaktive Modus
427
424
428
425
brightness = 0 ;
@@ -817,7 +814,7 @@ void interface_inactive(WebsocketsClient &client) {
817
814
if (millis () - interval > door_opened_millis) { // current time - face recognised time > 5 secs
818
815
digitalWrite (relay_pin, LOW); // close relay
819
816
mqttClient.publish (relaise.c_str (), " false" );
820
- mqttClient.publish (opener.c_str (), " false" );
817
+ mqttClient.publish (opener.c_str (), " false" );
821
818
}
822
819
}
823
820
ring (); // Klingel
@@ -884,16 +881,14 @@ void callback(char * topic, byte * payload, unsigned int length) {
884
881
if (strTopic == inTopic) {
885
882
if (strPayload == " on" || strPayload == " 1" || strPayload == " true" ){
886
883
take_send_photo ();
887
- mqttClient.publish (inTopic.c_str (), " false" );
888
- mqttClient.subscribe (inTopic.c_str ());
884
+ mqttClient.publish (inTopic.c_str (), " false" );
889
885
}
890
886
}
891
887
else
892
888
if (strTopic == foto) {
893
889
if (strPayload == " on" || strPayload == " 1" || strPayload == " true" ){
894
890
take_send_photo ();
895
- mqttClient.publish (foto.c_str (), " false" );
896
- mqttClient.subscribe (foto.c_str ());
891
+ mqttClient.publish (foto.c_str (), " false" );
897
892
}
898
893
}
899
894
else
@@ -996,8 +991,7 @@ void ring() {
996
991
mqttClient.connect (espName.c_str (), mqttUser, mqttPassword); // MQTT Server ESP32 Name
997
992
}
998
993
mqttClient.loop ();
999
- mqttClient.publish (inTopic.c_str (), " true" );
1000
- mqttClient.subscribe (inTopic.c_str ());
994
+ mqttClient.publish (inTopic.c_str (), " true" );
1001
995
delay (2000 );
1002
996
}
1003
997
}
0 commit comments