Added http response handling (debug output print).
This commit is contained in:
parent
d670b753dc
commit
ef6920dbe3
1 changed files with 12 additions and 1 deletions
|
@ -234,13 +234,24 @@ void _loop() {
|
||||||
if (currentSensorData[SENSOR_WINDSPEED] >= HTTP_CALL_ON_WINDSPEED_EXCEED_MPS)
|
if (currentSensorData[SENSOR_WINDSPEED] >= HTTP_CALL_ON_WINDSPEED_EXCEED_MPS)
|
||||||
{
|
{
|
||||||
digitalWrite(STATUS_LED_PIN, HIGH);
|
digitalWrite(STATUS_LED_PIN, HIGH);
|
||||||
|
|
||||||
// call the url HTTP_CALL_ON_WINDSPEED_URL
|
// call the url HTTP_CALL_ON_WINDSPEED_URL
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
|
|
||||||
http.begin(client, String(HTTP_CALL_ON_WINDSPEED_URL).c_str());
|
http.begin(client, String(HTTP_CALL_ON_WINDSPEED_URL).c_str());
|
||||||
http.end();
|
|
||||||
// Send HTTP GET request
|
// Send HTTP GET request
|
||||||
int httpResponseCode = http.GET();
|
int httpResponseCode = http.GET();
|
||||||
|
|
||||||
|
if (httpResponseCode > 0) {
|
||||||
|
String response = http.getString();
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.println("http response code: " + String(httpResponseCode) + " = " + response);
|
||||||
|
#endif
|
||||||
|
// TODO handle response
|
||||||
|
}
|
||||||
|
|
||||||
|
http.end();
|
||||||
debug("Called windspeed exceed callout");
|
debug("Called windspeed exceed callout");
|
||||||
digitalWrite(STATUS_LED_PIN, LOW);
|
digitalWrite(STATUS_LED_PIN, LOW);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue