diff --git a/main/main.ino b/main/main.ino index 8b0324d334..ee9242342a 100644 --- a/main/main.ino +++ b/main/main.ino @@ -530,9 +530,11 @@ void connectMQTT() { Log.warning(F("failure_number_mqtt: %d" CR), failure_number_mqtt); Log.warning(F("failed, rc=%d" CR), client.state()); #if defined(ESP32) - Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->lastError(nullptr, 0)); + if (mqtt_secure) + Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->lastError(nullptr, 0)); #elif defined(ESP8266) - Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->getLastSSLError()); + if (mqtt_secure) + Log.warning(F("failed, ssl error code=%d" CR), ((WiFiClientSecure*)eClient)->getLastSSLError()); #endif digitalWrite(LED_ERROR, LED_ERROR_ON); delay(2000);