Closed
Description
Board
Lilygo TG4 (ESP32 WROVER + SIM7600E)
Device Description
Using ESP32 Core 2.0.1 and ESP32 WROVER Kit (all versions)
Hardware Configuration
None
Version
v2.0.1
IDE Name
Ardiono 1.8.18
Operating System
macOS 12.1
Flash frequency
40Mhz
PSRAM enabled
no
Upload speed
115200
Description
When the Wifi is set to WIFI_MODE_APSTA, the BasicHttpsClient is returning an error -1 : connection refused.
The sketch only works in WIFI_MODE_STA.
How is it possible to force the WiFiClientSecure to use the STA instead of the AP interface?
Sketch
void sendPushover(String pushTitle, String pushMessage, uint8_t pushPriority) {
if (WiFi.status() == WL_CONNECTED) {
WiFiClientSecure *client = new WiFiClientSecure;
if (client) {
client -> setInsecure();
HTTPClient https;
if (https.begin(*client, pushServer)) {
Serial.println("Connection to pushover OK");
https.addHeader("Content-Type", "application/json");
String httpsRequestData = "{\"token\":\"" + pushToken + \
"\",\"user\":\"" + pushUser + \
"\",\"title\":\"" + pushTitle + \
"\",\"message\":\"" + pushMessage + \
"\",\"priority\":\"" + pushPriority + "\"}";
int httpsResponseCode = https.POST(httpsRequestData);
if (httpsResponseCode > 0) {
Serial.printf("Pushover response : %s\n", https.getString().c_str());
} else {
Serial.printf("Pushover error : %s\n", https.errorToString(httpsResponseCode).c_str());
}
https.end();
} else {
Serial.printf("Connection Pushover failed");
}
delete client;
}
} else {
Serial.println("Not connected to WiFi, using SIM instead");
}
}
Debug Message
httpsResponseCode = -1
Pushover response : connection refused
Other Steps to Reproduce
Changing Wifi mode to WIFI_MODE_APSTA
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.