@@ -767,10 +767,10 @@ void loop() {
767767
768768
769769
770-
771- int retry_wifi = 0 ;
772-
773770 #ifdef DEBUGLEVEL1
771+ // test de la connexion client mqtt
772+ Serial.print (" client connected ? :" );
773+ Serial.println (client.connected ());
774774// // test de synchro pour debug
775775 if (dimmer1.getsync ()) {
776776 Serial.println (" sync ok" );
@@ -806,6 +806,18 @@ void loop() {
806806 printTaskStack (myTaskwatchdogmemory, " myTaskwatchdogmemory" );
807807 #endif
808808
809+ // **** Loop - vérification de la connexion au serveur MQTT ****
810+ #ifndef LIGHT_FIRMWARE
811+ if (config.mqtt ) {
812+ if (!client.connected ()) {
813+ reconnect ();
814+ }
815+ client.loop (); // Keep the MQTT connection alive
816+ }
817+ #endif // not LIGHT_FIRMWARE
818+
819+ int retry_wifi = 0 ;
820+
809821 // ***********************************
810822 // ************* Loop - web socket loop
811823 // ***********************************
@@ -884,13 +896,13 @@ void loop() {
884896 strcpy (programme_marche_forcee.heure_demarrage , " 00:00" ); // NOSONAR
885897 strcpy (programme_marche_forcee.heure_arret , " 00:00" ); // NOSONAR
886898 // / remonté MQTT
887- #ifndef LIGHT_FIRMWARE
899+ /* #ifndef LIGHT_FIRMWARE
888900 Mqtt_send(String(config.IDX), String(unified_dimmer.get_power()),"pourcent"); // remonté MQTT de la commande réelle
889901 if (configmqtt.HA) {
890902 int instant_power = unified_dimmer.get_power();
891903 device_dimmer.send(String(instant_power * config.charge/100));
892904 }
893- #endif // not LIGHT_FIRMWARE
905+ #endif */ // not LIGHT_FIRMWARE
894906 } // if (programme.stop_progr() || programme_marche_forcee.stop_progr() )
895907 } // if (programme.run || programme_marche_forcee.run)
896908
@@ -910,7 +922,7 @@ void loop() {
910922 // demarrage du ventilateur
911923 digitalWrite (COOLER, HIGH);
912924 // / remonté MQTT
913- #ifndef LIGHT_FIRMWARE
925+ /* #ifndef LIGHT_FIRMWARE
914926
915927 Mqtt_send(String(config.IDX), String(unified_dimmer.get_power()),"pourcent"); // remonté MQTT de la commande réelle
916928 if (configmqtt.HA) {
@@ -921,6 +933,7 @@ void loop() {
921933 }
922934 }
923935 #endif // not LIGHT_FIRMWARE
936+ */
924937 } // if (programme.start_progr() || programme_marche_forcee.start_progr() )
925938 } // else
926939 } // if (config.dimmerlocal)
0 commit comments