Have questions about FETS, transistors, measurement, power supplies, or anything else electrical?

User avatar
By ejstave
#79854 All of my NodeMCU's stopped reporting to thingspeak @ 9:05am cst today. did some dinning on their website and found this:

During a planned update we noticed that some devices are sending data to ThingSpeak and closing the TCP connection without providing sufficient time for ThingSpeak API servers to respond, or confirming the data made its way to the ThingSpeak servers.

This is not a recommended approach as the assumption that the data being sent is accepted may not always be valid. For example, if your device tried to update a channel 50 times a second, that is faster than your allowed update rate. If the device did check the response, it would notice that it got a '0' response back indicating that the channel was not updated.

In the case of closing the connection before ThingSpeak sent a response code back, a HTTP 499 status code would be sent back, but, because the device wasn't leaving the connection open, this was not known to the device.

It is strongly recommended that you consider using the ThingSpeak library from https://github.com/mathworks/thingspeak-arduino for updating ThingSpeak channels from devices like Arduino, ESP8266, Particle Photon, Particle Electron, etc. The library provides a higher level API and manages the connections for you.

If you are noticing that your channels are no longer being updated by your Arduino or ESP8266 device, consider:

1) Modifying your code to use the library

OR

2) Modifying your code to wait till it gets a HTTP response code from ThingSpeak, or, at the very least waiting for 1 second before closing the connection and/or putting the device to deep sleep mode."

I am not using any library to upload my data... Just the standard code in this example: https://www.arduino.cc/en/Tutorial/WiFi ... taUploader

Its been working great for 6 months!

Guess I have to figure out how to get back devices deployed to collect data and reprogram!?
User avatar
By schufti
#79917 shows that "working for me" often is not good enough for being "standard"...

try modifying
Code: Select all  // Print Update Response to Serial Monitor
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
  // Disconnect from ThingSpeak


to
Code: Select all  // Print Update Response to Serial Monitor
  while (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
  // Disconnect from ThingSpeak


this should read the full response from the tsp server, not only one char...