I am trying to GET the daily peak output from my uploaded data to pvoutput.org. This data upload from the inverter is performed by a Raspi.
Now I want to GET the daily peak energy using a Arduino MKR1010 but my Arduino does/will not connect to the pvoutput.org server.
All I get is a “disconnecting from server” message after about 10sec.
The data does exist as I can get it manually from my browser.
https://pvoutput.org/service/r2/getstatus.jsp?key=myapireadkey&sid=mychID&d=20210530
What is the solution?
My Arduino code is based on
#include <WiFiNINA.h>
#include “secrets.h”
WiFiSSLClient client;
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio’s status
char server[] = “pvoutput.org”;
void setup() {
//Initialize serial:
Serial.begin(9600);
//while(!Serial);//may hang if usb unplugged
for (int i = 0; i < 5; i++) {
delay(1000);
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
}
if (client.connect(server, 443)) { // port 80 for HTTP, port 443 for HTTPS ?
Serial.println(“connected to server”);
// Make a HTTP request:
client.println("GET /getstatus.jsp?key=myapireadkey&sid=mychID&d=20210530 HTTP/1.1");
client.println("Host: pvoutput.org/service/r2");
client.println("Connection: close");
client.println();
}
// if there are incoming bytes available
// from the server, read them and print them:
while (client.available()) {
char c = client.read();
Serial.write©;
}
// if the server’s disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println(“disconnecting from server.”);
client.stop();
// do nothing forevermore:
while (true);
}
Serial.println(“end Setup”);
}
void loop() {
}