For the past 9 - 11 months I have had this home built weather station running on a photon. I’ve had little problem with it but recently, on Feb. 2 the upload protocol was working but nothing is being posted to WUndergound. I use TCPClient to send the data stream and was working with no problem. I was trying to get a result string to be returned so I could see what the problem is but was unable to get the client.read() to work correctly. Here is my code. Any help would be greatly appreciated.
TCPClient client;
char SERVER[] = "weatherstation.wunderground.com"; //https://weatherstation.wunderground.com
char WEBPAGE [] = "GET /weatherstation/updateweatherstation.php?"; ///weatherstation/updateweatherstation.php?
//char WEBPAGE [] = "/weatherstation/updateweatherstation.php?";
char ID [] = "KOKCLINT3";
//char SOFTVER [] = "&softwaretype=Arduino%20UNO%20version1&action=updateraw";
char SOFTVER [] = "&action=updateraw";
char PASSWORD [] = "";
float tempF = 32.0;
//float windDegrees = 180;
float humidityRH = 48.0;
float dewptf = 12.0;
float pressureKPa = 28;
//float rainIn = 0.00;
float windMPH = 14.0;
//float gustMPH = 25.0;
unsigned int timeNextPublish;
unsigned int publishPeriod = 30000;
void setup() {
}
void loop() {
if(timeNextPublish <= millis()) {
publisToWUnderground(tempF,pressureKPa,dewptf,humidityRH,windMPH);
timeNextPublish = millis() + publishPeriod;
}
}
void publisToWUnderground(float tempF, float baromin, float dewptf, float humidityRH, float windMPH) {
//Send data to Weather Underground
if (client.connect(SERVER, 80)) {
Particle.publish("xDEBUG", "Sending Data...");
// Ship it!
client.print(WEBPAGE);
client.print("ID=");
client.print(ID);
client.print("&PASSWORD=");
client.print(PASSWORD);
client.print("&dateutc=now");
//client.print("now"); //can use instead of RTC if sending in real time
client.print("&tempf=");
client.print(tempF);
client.print("&baromin=");
client.print(baromin);
client.print("&dewptf=");
client.print(dewptf);
//client.print("&humidity=");
//client.print(humidityRH);
//client.print("&windspeedmph=");
//client.print(windMPH);
client.print(SOFTVER); //&realtime=1&rtfreq=2.5");//Rapid Fire
client.println();
delay(800);
} else {
Particle.publish("xDEBUG", "Connection Failed");
}
client.stop();
}//End loop