Hallo zusammen,

ich bastel seit paar Tagen mit dem Nodemcu Board rum und versuche über Alexa einen HTTP Request abzufeuern. Es läuft wenn ich den Webserver des Nodemcu verwende und per Button die Aktion auslöse, sobald ich es jedoch in die Routine von fauxmo.onMessage einbinde und Alexa schalten lasse passiert nix, TCPDUMP auf dem Zielsystem zeigt jedoch dass eine Anfrage reinkommt vom Nodemcu.

Hat jemand vielleicht einen Tip was hier falsch ist?

Code:
#include <ESP8266HTTPClient.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"
#include "credentials.h"

#define SERIAL_BAUDRATE                 115200
#define Kaffee                          13
#define TV                              2

fauxmoESP fauxmo;

void tvclient() {
  HTTPClient http;
        http.begin("http://192.168.1.1:80/index.html");  //Specify request destination
        int httpCode = http.GET();
        String payload = http.getString();
        Serial.println(payload);
        Serial.println("Test");
        http.end();
}

// -----------------------------------------------------------------------------
// Wifi
// -----------------------------------------------------------------------------

void wifiSetup() {

    // Set WIFI module to STA mode
    WiFi.mode(WIFI_STA);

    // Connect
    Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
    WiFi.begin(WIFI_SSID, WIFI_PASS);

    // Wait
    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(100);
    }
    Serial.println();

    // Connected!
    Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

}

void setup() {

    // Init serial port and clean garbage
    Serial.begin(SERIAL_BAUDRATE);
    Serial.println();
    Serial.println();

    // Wifi
    wifiSetup();

    pinMode(TV, OUTPUT);
    digitalWrite(TV, HIGH);

    // Fauxmo
    fauxmo.addDevice("TV");
    fauxmo.addDevice("Kaffeemaschine");

    // fauxmoESP 2.0.0 has changed the callback signature to add the device_id, this WARRANTY
    // it's easier to match devices to action without having to compare strings.
    fauxmo.onMessage([](unsigned char device_id, const char * device_name, bool state) {
        Serial.printf("[MAIN] Device #%d (%s) state: %s\n", device_id, device_name, state ? "ON" : "OFF");
        if (strcmp(device_name, "TV") == 0) {
        if (state) {
        digitalWrite(TV, LOW);  
        tvclient();
        } else {
        digitalWrite(TV, HIGH);
        }
        }
        });

}

void loop() {

    // Since fauxmoESP 2.0 the library uses the "compatibility" mode by
    // default, this means that it uses WiFiUdp class instead of AsyncUDP.
    // The later requires the Arduino Core for ESP8266 staging version
    // whilst the former works fine with current stable 2.3.0 version.
    // But, since it's not "async" anymore we have to manually poll for UDP
    // packets
    fauxmo.handle();


    static unsigned long last = millis();
    if (millis() - last > 5000) {
        last = millis();
        Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
    }

}

Grüße

Daniel