Closed samtrot closed 3 years ago
Here is my sketch, if this helps:
#include <Arduino.h>
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#include <fauxmoESP.h>
#include "credentials.h"
fauxmoESP fauxmo;
// -----------------------------------------------------------------------------
#define SERIAL_BAUDRATE 115200
void wifiSetup() {
WiFi.mode(WIFI_STA);
Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println();
Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
}
void setup() {
Serial.begin(SERIAL_BAUDRATE);
Serial.println();
Serial.println();
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LEDSwitch);
wifiSetup();
fauxmo.createServer(true); // not needed, this is the default value
fauxmo.setPort(80); // This is required for gen3 devices
fauxmo.enable(true);
fauxmo.addDevice("blue Lamp");
fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
Serial.printf("[MAIN] Device #%d (%s) state: %s value: %d\n", device_id, device_name, state ? "ON" : "OFF", value);
if (strcmp(device_name, "blue Lamp") == 0) {
digitalWrite(LED_BUILTIN, state ? HIGH : LOW);
}
});
}
void loop() {
fauxmo.handle();
static unsigned long last = millis();
if (millis() - last > 5000) {
last = millis();
Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
}
}
Someone else had a similar issue recently - try setting lwIP Variant
to v1.4 Higher Bandwidth
(Ref: https://github.com/vintlabs/fauxmoESP/issues/120#issuecomment-742090628)
If that doesn't do it, open the "ESP Exception Decoder" in tools menu, paste the exception info in and post the output from there.
Thank you very much - this did the trick for me, too. I'd have never searched for LwIP.
Excellent! I still need to check into this more... I can use v2 without problem, but others have had issues as well. Thanks for the feedback
Hello,
FauxmoESP 3.1.2 on nodemcu
I have used the example code and reduced it also. Device gets Wifi connection
However, I get an "user exception" as soon as I start the discovery from the alexa app.
asdf
I don't konw, what's wrong - could you please help me out where I could start?
Best Regards, samtrot