ThingSpeak Channel stopped receiving data since April 13th 2022
1 view (last 30 days)
Show older comments
My channel had been working fine for over a year until April 13 arrived. I've actually just noticed that the channel has not been updating for the past 4 months.
I have read a few topics on this issue and tried to fix the problem myself but not being a coder I have failed misarably. It seems the issue is related to an update done on ThingSpeak and is related to how spaces are encoded (%20). So here is the code that I presume needs fixing:
// code block for uploading data to Thingspeak website
if (App2 == "THINGSPEAK") {
// Send data to ThingSpeak
WiFiClient client;
if (client.connect(server,80)) {
Serial.println("Connect to ThingSpeak - OK");
String postStr = "";
postStr+="GET /update?api_key=";
postStr+=api_key;
postStr+="&field1=";
postStr+=String(rel_pressure_rounded);
postStr+="&field2=";
postStr+=String(measured_temp);
postStr+="&field3=";
postStr+=String(measured_humi);
postStr+="&field4=";
postStr+=String(volt);
postStr+="&field5=";
postStr+=String(measured_pres);
postStr+="&field6=";
postStr+=String(DewpointTemperature);
postStr+="&field7=";
postStr+=String(HeatIndex);
postStr+="&status=";
postStr+=String(forecast_in_words + ": " + ZambrettisWords + ". " + pressure_in_words + " " + trend_in_words + ". " + accuracy_in_words + " " + accuracy_in_percent + "%25.");// Percentage sign needs to be URL-encoded
postStr+=" HTTP/1.1\r\nHost: a.c.d\r\nConnection: close\r\n\r\n";
postStr+="";
client.print(postStr);
Serial.println("Data written to Thingspeak ...");
}
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
}
Can anyone help me fix this? Thank you.
0 Comments
Answers (2)
Christopher Stapels
on 29 Aug 2022
I dont see the problem directly. I would reccomend you try removing things one at a time.
For example, you could comment after field 1 and try just writing a set number to ThingSpeak. (here I used 123)
String postStr = "";
postStr+="GET /update?api_key=";
postStr+=api_key;
postStr+="&field1=123";
//postStr+=String(rel_pressure_rounded);
//postStr+="&field2=";
...
client.print(postStr);
Then add each line back in one at a time to make sure it works.
This line also looks a bit odd
postStr+=String(forecast_in_words + ": " + ZambrettisWords + ". " + pressure_in_words + " " + trend_in_words + ". " + accuracy_in_words + " " + accuracy_in_percent + "%25.");// Percentage sign needs to be URL-encoded
Let us know if you figure out the offending line.
Communities
More Answers in the ThingSpeak Community
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!