Hi,
I'm trying to read out some data from heater, which share data on it's own webserver. I'm using example program HTTP basic client, from ESP8266 library. It's reading fine, but there is delay 5 second between reading. Delay is caused by String payload = http.getString(); function. I suspect there is something timing out. Any ideas? Thanks
ESP8266 NodeMcu V3 (china)
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
ESP8266WiFiMulti WiFiMulti;
void setup() {
Serial.begin(115200);
// Serial.setDebugOutput(true);
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("Brozapetr", "");
}
void loop() {
// wait for WiFi connection
if ((WiFiMulti.run() == WL_CONNECTED)) {
WiFiClient client;
HTTPClient http;
if (http.begin(client, "http://192.168.1.3/ext/daqdata.cgi?key=asdfas595ds")) { // HTTP
int httpCode = http.GET();
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTP] GET... code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
[b]String payload = http.getString();[/b]
Serial.println(payload);
}
} else {
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
} else {
Serial.printf("[HTTP} Unable to connect\n");
}
}
// delay(10000);
}
Content of web page (plain text):
["PLNE ZATIZENI",69.86,5.12,56,70.93,68.12,32.69,99,9.80,1,true,120.00,0,-20.00,0,-20.00,0,true,60.00,24.68,36.33,true,7.91,31.92,true,true,-9.00,-9.00,-20.00,true,-9.00,70.00,true,true,-9.00,-9.00,-20.00,true,-9.00,70.00,true," ",120.00,"NORMAL","VYPNUTO","VYPNUTO","VYPNUTO","VYPNUTO","VYPNUTO","VYPNUTO","VYPNUTO","VYPNUTO","VYPNUTO",1181724,2466,344,120.00,-20.00,-20.00,true,true,true,70.00,70.00,70.00,-20.00,-20.00,-20.00,-20.00,-20.00,-20.00,true,true,true]
