Hi everyone. I’m using some webhooks for weather data, and I’m having an issue with the latest one I added to my code.
I can verify that the event occurs, and the data from the weather API makes it to the particle cloud; however, it never makes it to my device when hook-response is triggered.
Here’s the relevant parts of my code.
//CODE - WEBHOOKS//
Serial.println("Retrieving webhook data...");
Serial.println("");
Particle.publish("getWeather1");
Particle.subscribe("hook-response/getWeather1",gotWeather1,MY_DEVICES);
delay(4000);
Particle.publish("getForecast1");
Particle.subscribe("hook-response/getForecast1",gotForecast1,MY_DEVICES);
delay(4000);
Particle.publish("getWeather2");
Particle.subscribe("hook-response/getWeather2",gotWeather2,MY_DEVICES);
delay(4000);
Particle.publish("getWeather3");
Particle.subscribe("hook-response/getWeather3",gotWeathergotForecast3,MY_DEVICES);
delay(4000);
Particle.publish("getForecast4");
Particle.subscribe("hook-response/getForecast4",gotForecast4,MY_DEVICES);
//CODE - HANDLER "gotForecast4"//
void gotForecast4(const char *name, const char *data)
{
String str4f = String(data);
Serial.println("Forecast 4:");
Serial.println(str4f);
Serial.println("");
}
//END CODE//
To be clear, it is only the last subscription that doesn’t work; the rest are functioning perfectly. And, as I said, I can see hook-response/getForecast4 on the console event monitor, and it does indeed return JSON data, just like all my other webhooks.
Anyone have any clue why this one doesn’t get the data, though the other ones do?
Thanks in advance,
Brad