Skip to content

Commit 31cc92e

Browse files
committed
Mention URL+Port if non-standard. Fix local SSL/TLS MQTT testing
1 parent d85a868 commit 31cc92e

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/Wippersnapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,6 +2757,12 @@ void printDeviceInfo() {
27572757
WS_DEBUG_PRINTLN(BOARD_ID);
27582758
WS_DEBUG_PRINT("Adafruit.io User: ");
27592759
WS_DEBUG_PRINTLN(WS._config.aio_user);
2760+
if (strncmp(WS._config.aio_url, "io.adafruit.com", 16) != 0) {
2761+
WS_DEBUG_PRINT("Adafruit.io URL: ");
2762+
WS_DEBUG_PRINTLN(WS._config.aio_url);
2763+
WS_DEBUG_PRINT("Adafruit.io Port: ");
2764+
WS_DEBUG_PRINTLN(WS._config.io_port);
2765+
}
27602766
WS_DEBUG_PRINT("WiFi Network: ");
27612767
WS_DEBUG_PRINTLN(WS._config.network.ssid);
27622768

src/network_interfaces/Wippersnapper_ESP32.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,21 @@ class Wippersnapper_ESP32 : public Wippersnapper {
196196
_mqtt_client_secure, WS._config.aio_url, WS._config.io_port, clientID,
197197
WS._config.aio_user, WS._config.aio_key);
198198
} else {
199-
// Insecure connections require a NetworkClient object rather than a
200-
// NetworkClientSecure object
201-
_mqtt_client_insecure = new NetworkClient();
202-
WS._mqtt = new Adafruit_MQTT_Client(
203-
_mqtt_client_insecure, WS._config.aio_url, WS._config.io_port,
199+
if (WS._config.io_port == 8883) {
200+
_mqtt_client_secure = new NetworkClientSecure();
201+
_mqtt_client_secure->setInsecure();
202+
WS._mqtt = new Adafruit_MQTT_Client(
203+
_mqtt_client_secure, WS._config.aio_url, WS._config.io_port,
204204
clientID, WS._config.aio_user, WS._config.aio_key);
205+
} else {
206+
// Insecure connections require a NetworkClient object rather than a
207+
// NetworkClientSecure object
208+
_mqtt_client_insecure = new NetworkClient();
209+
WS._mqtt = new Adafruit_MQTT_Client(
210+
_mqtt_client_insecure, WS._config.aio_url, WS._config.io_port,
211+
clientID, WS._config.aio_user, WS._config.aio_key);
212+
}
213+
205214
}
206215
}
207216

0 commit comments

Comments
 (0)