current code only gives the words BOOTING on serial monitor.
#include <HTTPClient.h>
//#include <ESP32HTTPClient.h>
#define BLYNK_PRINT Serial
#include <ArduinoJson.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "************************b";
char ssid[] = "**************";
char pass[] = "********************";
BlynkTimer timer;
String payload;
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,120), 8080);
delay (3000);
int rssi = WiFi.RSSI() ; //get signal strenth in DB
Blynk.virtualWrite(V51,rssi);
Blynk.virtualWrite(V0, 1); //update for webhooks
Serial.println("Booting");
timer.setInterval(6000L, APIupdate);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
void APIupdate(){
Blynk.virtualWrite(V0, 1); //update for webhooks
}
BLYNK_WRITE(V0){
HTTPClient http; //Declare an object of class HTTPClient
http.begin("https://api.ipgeolocation.io/astronomy?apiKey=c5f0ed1688714f2eaa25a37a8c720912&lat=51.31962&long=-4.80284"); //Specify request destination
int httpCode = http.GET(); //Send the request
if (httpCode > 0) { //Check the returning code
payload = http.getString(); //Get the request response payload
}
http.end(); //Close connection
//String payload = http.getString();
Serial.println(payload);
const size_t capacity = JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(18) + 320;
DynamicJsonDocument doc(capacity);
const char* json = "(payload)";
deserializeJson(doc, json);
float location_latitude = doc["location"]["latitude"]; //
float location_longitude = doc["location"]["longitude"]; //
const char* date = doc["date"]; // "2020-09-30"
const char* current_time = doc["current_time"]; // "19:06:46.27"
const char* sunrise = doc["sunrise"]; // "07:18"
const char* sunset = doc["sunset"]; // "18:59"
const char* sun_status = doc["sun_status"]; // "-"
const char* solar_noon = doc["solar_noon"]; // "13:09"
const char* day_length = doc["day_length"]; // "11:41"
float sun_altitude = doc["sun_altitude"]; // -2.0393480763745733
float sun_distance = doc["sun_distance"]; // 149810371.16339526
float sun_azimuth = doc["sun_azimuth"]; // 267.4597814448824
const char* moonrise = doc["moonrise"]; // "19:02"
const char* moonset = doc["moonset"]; // "05:23"
const char* moon_status = doc["moon_status"]; // "-"
float moon_altitude = doc["moon_altitude"]; // 1.0738509355096701
float moon_distance = doc["moon_distance"]; // 402084.5279459498
float moon_azimuth = doc["moon_azimuth"]; // 100.76227521973334
float moon_parallactic_angle = doc["moon_parallactic_angle"]; // -38.56220668133565
Serial.println(sun_altitude);
Serial.println(sun_azimuth);
Serial.println(location_latitude);
}~~~