Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue getting data from wunderground... #1022

JasonMeredith1 opened this issue Jun 10, 2019 · 2 comments


None yet
2 participants
Copy link

commented Jun 10, 2019

I am trying to get just a few pieces of data from the wunderground API... I have been following along on several examples but I am missing where the returned string gets passed to deserialize. can anyone here give me a clue what I need to add.

    Created on: 20.08.2018
#include <ArduinoJson.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>

// Current fingerprint for
const uint8_t fingerprint[20] = {0x5D, 0xC3, 0x85, 0xD6, 0x19, 0x22, 0x99, 0x2B, 0x7B, 0xBB, 0x87, 0x8F, 0xD6, 0x9E, 0xF2, 0xD5, 0x44, 0xDA, 0x32, 0x28};

ESP8266WiFiMulti WiFiMulti;

void setup() {


  for (uint8_t t = 4; t > 0; t--) {
    Serial.printf("[SETUP] WAIT %d...\n", t);

  WiFiMulti.addAP("-------", "-------");

void loop() {
  // wait for WiFi connection
  if (( == WL_CONNECTED)) {
    std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
    HTTPClient https;
    Serial.print("[HTTPS] begin...\n");
    if (https.begin(*client, "")) {
      Serial.print("[HTTPS] GET...\n");
      int httpCode = https.GET();
      if (httpCode > 0) {
        Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
    if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
      Serial.printf("[HTTPS] httpCode:  %d\n" , httpCode);
      const size_t capacity = JSON_ARRAY_SIZE(1) + 20*JSON_ARRAY_SIZE(6) + 27*JSON_ARRAY_SIZE(12) + JSON_OBJECT_SIZE(21) + JSON_OBJECT_SIZE(27);
      Serial.printf("[JSON] capacity: %d\n" , capacity);
      DynamicJsonDocument doc(capacity);
      deserializeJson(doc, client);
      //DeserializationError error = deserializeJson(doc, client);
      //if (error) {
      //  Serial.print(F("deserializeJson() failed: "));
      //  Serial.println(error.c_str());
      //  return;
      } else {
        Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());
    } else {
      Serial.printf("[HTTPS] Unable to connect\n");
  // Extract values
 // Serial.print(doc["dayOfWeek"][0].as<char*>());  
  Serial.println("Wait 180s before next round...");

This comment has been minimized.

Copy link

commented Jun 12, 2019

Hi @JasonMeredith1,

You can get the underlying WiFiClient by calling HTTPClient::getStream():

DeserializationError error = deserializeJson(doc, client->getStream());

If you want a complete example using ESP8266HTTPClient, please check out the "GitHub" case study in Mastering ArduinoJson.

BTW, I thought Weather Underground shut down their API; how can you still be using it?

Best Regards,

@bblanchon bblanchon added the question label Jun 12, 2019


This comment has been minimized.

Copy link

commented Jun 12, 2019

I got it figured out after a few hours banging around in the examples :), If you have a PWS (personal weather station) you get an API key from Wunderground. I am now trying to figure out how to pass my returned string of data to an LED matrix so I can have a ticker with the weather for out flight communications center. with the Wemos Minis being so cheap I can thing a several projects to get on the workbench! Thanks again for making such a great library!

Fair WInds,

Repository owner locked and limited conversation to collaborators Jul 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.