/* ALEXA MODULE Copyright (C) 2016-2017 by Xose PĂ©rez */ #if ALEXA_SUPPORT #include fauxmoESP alexa; // ----------------------------------------------------------------------------- // ALEXA // ----------------------------------------------------------------------------- bool _alexa_change = false; unsigned int _alexa_device_id = 0; bool _alexa_state = false; #if WEB_SUPPORT void _alexaWSSend(JsonObject& root) { root["alexaVisible"] = 1; root["alexaEnabled"] = getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1; } #endif // ----------------------------------------------------------------------------- void alexaConfigure() { alexa.enable(getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1); } void alexaSetup() { // Backwards compatibility moveSetting("fauxmoEnabled", "alexaEnabled"); // Load & cache settings alexaConfigure(); #if WEB_SUPPORT // Websockets wsRegister(_alexaWSSend); #endif unsigned int relays = relayCount(); String hostname = getSetting("hostname"); if (relays == 1) { alexa.addDevice(hostname.c_str()); } else { for (unsigned int i=0; i