fauxmo.onMessage

Hello!

Have the same issue and I have no clue how to solve the issue:

#include <Arduino.h>
#include <fauxmoESP.h>
#include <ESP8266WiFi.h>

#define WIFI_SSID "******"
#define WIFI_PASS "******"
#define SERIAL_BAUDRATE 115200

fauxmoESP fauxmo;

// -----------------------------------------------------------------------------
// 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 callback(uint8_t device_id, const char * device_name, bool state) {
Serial.print("Device "); Serial.print(device_name); 
Serial.print(" state: ");
if (state) {
Serial.println("ON");
digitalWrite(D2,HIGH);
} else {
Serial.println("OFF");
digitalWrite(D2,LOW);
}
}

void setup() {
// Init serial port and clean garbage
Serial.begin(SERIAL_BAUDRATE);
Serial.println("FauxMo demo sketch");
Serial.println("After connection, ask Alexa/Echo to 'turn <devicename> on' or 'off'");

pinMode(D2,OUTPUT);

// Wifi
wifiSetup();

// Fauxmo
fauxmo.addDevice("Fish Tank");
fauxmo.onMessage(callback);
}

void loop() {
fauxmo.handle();
}