Skip to content

Commit

Permalink
Arduino ESP8266, ESP32: add logging SSL connection error to LAST STATE
Browse files Browse the repository at this point in the history
  • Loading branch information
klew committed Nov 29, 2023
1 parent 7db7da6 commit 409245d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/supla/arduino_esp_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <WiFiClient.h>
#include <WiFiClientSecure.h>
#include <supla/clock/clock.h>
#include <SuplaDevice.h>

#include "tools.h"
#include "supla/network/client.h"
Expand Down Expand Up @@ -128,6 +129,10 @@ class ArduinoEspClient : public Client {

if (lastErr) {
SUPLA_LOG_ERROR("SSL error: %d, %s", lastErr, buf);
if (sdc && (lastConnErr != lastErr)) {
lastConnErr = lastErr;
sdc->addLastStateLog(buf);
}
}
}

Expand Down Expand Up @@ -158,6 +163,7 @@ class ArduinoEspClient : public Client {
WiFiClient *wifiClient = nullptr;
String fingerprint;
uint16_t timeoutMs = 3000;
int lastConnErr = 0;
#ifdef ARDUINO_ARCH_ESP8266
X509List *caCert = nullptr;
#endif
Expand Down

0 comments on commit 409245d

Please sign in to comment.