I am using an Adafruit feather esp32 v2 board and developing in Arduino.
Have been, for a good few months, able to post data to Emoncms.org using GET input/bulk as below.
void publishMessage_emonCMS() {
//HTTP post to emonCMS
WiFiClientSecure* client2 = new WiFiClientSecure;
client2->setInsecure();
if (client2) {
client2->setCACert(rootCACertificate);
{
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
HTTPClient https;
String HTTPurl = "https://emoncms.org/input/bulk?data=[[0,10015,{\"wifirssi\":" + String(WiFi.RSSI()) + ",\"Co2\":0,\"temperature\":" + String(temp.temperature) + ",\"humidity\":" + String(humidity.relative_humidity) + "}]]&apikey=XXXXXXXXXXXXXXXXXXX";
Serial.print("[HTTPS] begin....\n");
if (https.begin(*client2, HTTPurl)) { // HTTPS
Serial.print("[HTTPS] GET.. emonCMS.." + String(HTTPurl)); //.substring(0,115)
// start connection and send HTTP header
httpCode = https.GET();
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been sent and Server response header has been handled
Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = https.getString();
Serial.println(payload);
}
} else {
Serial.printf("[HTTPS] GET... failed, error what?: %s\n", https.errorToString(httpCode).c_str());
}
https.end();
} else {
Serial.printf("[HTTPS] Unable to connect\n");
}
// End extra scoping block
}
delete client2;
} else {
Serial.println("Unable to create client");
}
}
This is suddenly stopped working with an http response of “-1” “Connection refused.”
When I copy out the resultant url from the Arduino Serial Monitor which I have printed out for debug e.g.
"https://emoncms.org/input/bulk?data=[[0,10015,{"wifirssi":-44,"Co2":0,"temperature":21.39,"humidity":60.97,"ts1":20.33,"ts2":20.35,"ts3":20.35}]]&apikey=XXXXXXXXXXXXXXXXXXXXX"
…then past it into a web browser is works fine and I can see the data in my account on the correct node on Emoncms.org!
At first I though it maybe due to SSL certificate on Emoncms.org being updated but I have tested with the new one and I also have devices which are still connected and running with the old certificate.
Any ideas or thoughts welcome, Thanks