Verstanden! VIELEN DANK!
Wenn ich nur gleich das richtige Beispiel gefunden hätte....
Jetzt läufts perfekt:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define ssid "******"
#define password "******"
bool aktor(int mC, int aktor, int set) {
bool value = false;
if (WiFi.status() == WL_CONNECTED) {
String message = F("<?xml version='1.0'?>\n<methodCall>\n<methodName>");
if (set != -1) {
message +=F("set_aktor");
} else {
message +=F("read_as");
}
message += F("</methodName>\n<params>\n"
"<param><value><int>");
message += aktor;
message += F("</int></value></param>\n"
"</params>\n</methodCall>\n");
WiFiClient client;
HTTPClient http;
http.begin(client,("http://DG-Home-" + String(mC) + ":55072"));
int check = http.POST(message);
if (check > 0) {
if (check == HTTP_CODE_OK) {
const String& httpCode = http.getString();
int start_value = httpCode.indexOf("<int>") + 5;
if (start_value > 5) {
int stop_value = httpCode.indexOf("</int>");
const String& value_str = httpCode.substring(start_value, stop_value);
if (value_str.toInt()) {
value = true;
}
}
}
}
http.end();
}
return value;
}
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.begin(ssid, password);
Serial.print(F("Connecting"));
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print(F("Connected, IP address: "));
Serial.println(WiFi.localIP());
}
void loop() {
bool a = aktor (64, 169, -1);
bool b = aktor (64, 170, -1);
bool c = aktor (64, 171, -1);
bool d = aktor (60, 175, -1);
Serial.println(a + b + c + d);
delay (1000);
}