Alexa 无法识别 Fauxmo 和 ESP8266

物联网 联网 亚历克斯 ESP8266
2021-06-08 01:07:55

我正在尝试使用 fauxmo 控制 ESP8266。程序编译正确,但是当我运行 Alexa 应用程序来查找设备时,ESP 没有出现。

ESP 肯定连接到我的家庭网络,并且程序正在运行(我已经检查了串行输出)。其他联网设备,比如我的 Nest 恒温器也出现了。

任何关于为什么它可能不会出现的想法,非常感谢。

这是我的 wemos d1 mini 上的代码

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.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");
  } else {
    Serial.println("OFF");
  }
}

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'");

    // Wifi
    wifiSetup();

    // Fauxmo
    fauxmo.addDevice("relay");
    fauxmo.addDevice("pixels");
    fauxmo.onMessage(callback);
}

void loop() {
  fauxmo.handle();
}
1个回答

所以我找到了解决问题的方法。

我原本打算将 Fire TV Stick Alexa 连接到 esp。我硬着头皮买了一个 Echo dot。

问题解决了。

Fauxmo 目前的状态似乎不适用于 Fire TV。