I have a Thermostat control project that is behaving strangely when talking to cosm. It works well for some number of cycles then stops updating. I have inserted print statements and am posting the last good update and the first bad update. In this case the last good update was at cycle 300. The cosm update code looks like this:
Serial.println("Connecting...");
if (client.connect(server, 80)) {
client.print("GET /api/");
client.print(REMOTE_FEED_ID);
client.print(".csv HTTP/1.1\nHost: pachube.com\nX-PachubeApiKey: ");
client.print(PACHUBE_API_KEY);
client.print("\nUser-Agent: Arduino (Pachube In Out v1.1)");
client.println("\n");
//Serial.println("finished GET now PUT, to update");
client.print("PUT /api/");
client.print(SHARE_FEED_ID);
client.print(".csv HTTP/1.1\nHost: pachube.com\nX-PachubeApiKey: ");
client.print(PACHUBE_API_KEY);
client.print("\nUser-Agent: Arduino (Pachube In Out v1.1)");
client.print("\nContent-Type: text/csv\nContent-Length: ");
client.print(content_length);
client.print("\nConnection: close\n\n");
client.print(pachube_data);
client.print("\n");
The output shows a trincation in the "X-PachubeApiKey" line and I can not figure out what would cause this. I have substituted the text "my_key_was_correctly_listed_here" exactly where my key is printing out. I have also highlighted in red the good lines and then the bad lines. Any suggestions would be much appreciated. I have checked for data memory overflow, the sketch indicates 72% at it's start. Something is getting overwritten but I can't find it. If you think this is the problem then any suggestions about how to find it would be appreciated.
reset ethernet
GET /api/getfeed#.csv HTTP/1.1
Host: pachube.com
[color=red]X-PachubeApiKey: my_key_was_correctly_listed_here[/color]
User-Agent: Arduino (Pachube In Out v1.1)
PUT /api/putfeed#.csv HTTP/1.1
Host: pachube.com
[color=red]X-PachubeApiKey: my_key_was_correctly_listed_here[/color]
User-Agent: Arduino (Pachube In Out v1.1)
Content-Type: text/csv
Content-Length: 33
Connection: close
776,610,705,707,703,703,737,300,0
HTTP/1.1 200 OK
Date: Sun, 10 Jun 2012 02:13:02 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
Last-Modified: Sat, 09 Jun 2012 05:51:04 GMT
X-Runtime: 32
X-Pachube-Logging-Key: logging.EgdfTlyjwCw1ZweUULUK
Content-Length: 21
X-PachubeRequestId: fcaa00dd573168a3dd0982fc0e08da9272cae065
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlMmJiNjhAge: 73313
Cache-Control: max-age=86400
Accept-Encoding
--- updated:
776,610,705,707,703,703,737,300,0
--- retrieved:
0 0 0 0 0 1 0 0 0 0 1
0Date: Sun, 10 Jun 2012 02:13:02 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
X-PachubePurgeCache: t:feeds/5744
X-Runtime: 101
Content-Length: 1
X-Pachube-Logging-Key: logging.EgdfTlyjwCw1ZweUULUK
X-PachubeRequestId: e89959ce93cec852e627f538b24adb8fdd830884
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlMjY0YzA5Cache-Control: max-age=0
Accept-Encoding
reset ethernet
GET /api/getfeed#.csv HTTP/1.1
Host: pachube.com
[color=red]Xmy_key_was_correctly_listed_here[/color]
User-Agent: Arduino (Pachube In Out v1.1)
PUT /api/putfeed#.csv HTTP/1.1
Host: pachube.com
[color=red]Xmy_key_was_correctly_listed_here[/color]
User-Agent: Arduino (Pachube In Out v1.1)
Content-Type: text/csv
Content-Length: 33
Connection: close
776,609,705,707,703,703,737,301,0
HTTP/1.1 401 Unauthorized
Date: Sun, 10 Jun 2012 02:13:49 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
WWW-Authenticate: Basic realm="Web Password"
Content-Length: 50
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlN2I0YWNCache-Control: no-cache
You do not have permission to access this resourceHTTP/1.1 401 UnDate: Sun, 10 Jun 2012 02:13:49 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
WWW-Authenticate: Basic realm="Web Password"
Content-Length: 50
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlNThlOTUCache-Control: no-cache