Hi, I need your help. I try to receive weather data from openweathermap.org with my "WeMos D1 Wireless UNO ESP8266". I have the following code:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
HTTPClient sender;
WiFiClientSecure wifiClient;
#include <ArduinoJson.h>
// WLAN-Daten
const char* ssid = "YOUR-SSID"; //your-ssid
const char* password = "YOUR-PASSWORD"; //your-password
void setup() {
Serial.begin(115200);
Serial.println("INIT");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(200);
Serial.print(".");
}
Serial.println("Connected to wifi!");
Serial.println();
wifiClient.setInsecure();
delay(500);
// put your setup code here, to run once:
Serial.println("START REQUEST for forecast");
if (sender.begin(wifiClient, "https://api.openweathermap.org/data/2.5/forecast?q=61440&appid=b045804ab93431828b3e101e2be26dc1")) { //This Api-Key isn't from me it is from https://www.grepper.com/tpc/open+weather+api+key#527978
int httpCode = sender.GET();
Serial.println(httpCode);
if (httpCode > 0) {
if (httpCode == 200) {
String payload = sender.getString();
Serial.print("PAYLOAD: \"");
Serial.println(payload + "\"");
} else {
Serial.print("HTTP-Error: " + String(httpCode));
}
}
}
sender.end();
Serial.println("DONE");
}
void loop() {
// put your main code here, to run repeatedly:
}
But I get no payload back. If I request other api-points such as https://api.openweathermap.org/data/2.5/weather?q=61440&appid=b045804ab93431828b3e101e2be26dc1 I get a payload. Does anyone know what's going on?