Fauxmo, ESP32 not detected

Hello,

I'am trying to control the blue led on the ESP32 (dev kit 1) using alexa (Fauxmo),
unfortunately my Alexa (phone & sonos beam) coudn't detect my esp32 :frowning:

Any thing wrong with my code hereunder?

Thank you.

#include <WiFi.h>
#include <AsyncTCP.h>

        //-------------------------------
#include "fauxmoESP.h"
fauxmoESP fauxmo;
bool alexaTrigger = false;
byte alexaTurn = 0; 
//--------------------------------------------------------------------------------------------------------------------------------
#define WIFI_SSID "Livebox-4156"
#define WIFI_PASS "covid2020"
        //-------------------------------
#define LED "Blue"   

//---------------------------------------------------------------------------------------------------------------------------------
void wifiSetup() {
 
  WiFi.disconnect();
  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()
{
wifiSetup();
pinMode(2, OUTPUT); 


fauxmo.createServer(true); 
  fauxmo.setPort(80); // 
  fauxmo.enable(true);
  

  fauxmo.addDevice(LED);

  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, LED) == 0) ) {
     
      //Serial.println("ALEXA TRIGGERED");  
      alexaTrigger = true;
      if (state) {
        //Serial.println("LED ON");  
        alexaTurn = 1;
   
      } else {
        //Serial.println("LED OFF"); 
        alexaTurn = 0;
     
      }
    }
  });

}


//-----------------------------------------------------------------------------------------------------------------------------------
void loop() 
{
   fauxmo.handle();
  if (alexaTrigger) {
    alexaTrigger = false; //Reset the trigger
    if (alexaTurn){ 
            digitalWrite(2, HIGH); 
            
    }
    else   { 
      digitalWrite(2, LOW); 
    
    }}
}

Post links to the stuff you used (links, hardware, services, etc.)!

Arduino IDE : 1.8.19
Fauxmo : 3.4.0
Esp32 : https://a.aliexpress.com/_mMUAyTq
Sonos (Alexa built in) : https://www.amazon.fr/dp/B09B13XFGY/ref=cm_sw_r_apan_glt_i_DCWJVXNZ26YQY0D0YX51
Phone: Galaxy S9+

Are the ESP and the other devices (Alexa, phone) in the same WiFi network? Is "device isolation" disabled in the router configuration? Does the router firewall block multicast traffic?

Umm not sure what you mean by device isolation. (My network level is near 0 :smile: )

My esp32 is connected to the wifi (I can see it)
The firewall is set to the minimum
UPnP is enabled
My wifi is 2.4GHz

I tried another bit of code with the library ESPAlexa, still not detected :confused:

Does your Alexa detect the Philips Hue controller?

I don't have a Philips hue controller (bridge) :no_mouth: do I need it?
I have several sonoff wifi products that works well with Alexa (thru ewilink skill)

As the fauxmo library emulates a Philips Hue bridge it would be a good test if the Alexa recognizes that device. I don't have an Alexa (and don't want such a type of device), so I cannot test if it knows out of the box how to handle Philips Hue device. Maybe it needs an update to see this type of device?
At the moment you simply assume that your Alexa knows what it has to do and the ESP32 is on fault. I have some doubts this assumption is justified. But, of course, I may be wrong.

I will try to find a hue bridge to test.
Thank you a lot anyway :blush:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.