diff --git a/code/espurna/alexa.ino b/code/espurna/alexa.ino index c1cced8a..a8d4bc96 100644 --- a/code/espurna/alexa.ino +++ b/code/espurna/alexa.ino @@ -30,6 +30,7 @@ bool _alexaWebSocketOnReceive(const char * key, JsonVariant& value) { void _alexaWebSocketOnSend(JsonObject& root) { root["alexaVisible"] = 1; root["alexaEnabled"] = alexaEnabled(); + root["alexaName"] = getSetting("alexaName"); } void _alexaConfigure() { @@ -84,9 +85,11 @@ void alexaSetup() { alexa.createServer(!WEB_SUPPORT); alexa.setPort(80); - // Uses hostname as base name for all devices - // TODO: use custom switch name when available - String hostname = getSetting("hostname"); + // Use custom alexa hostname if defined, device hostname otherwise + String hostname = getSetting("alexaName", ALEXA_HOSTNAME); + if (hostname.length() == 0) { + hostname = getSetting("hostname"); + } // Lights #if RELAY_PROVIDER == RELAY_PROVIDER_LIGHT diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 48139989..2ec66f46 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -1227,6 +1227,11 @@ #define ALEXA_ENABLED 1 #endif +#ifndef ALEXA_HOSTNAME +#define ALEXA_HOSTNAME "" +#endif + + // ----------------------------------------------------------------------------- // MQTT RF BRIDGE // ----------------------------------------------------------------------------- diff --git a/code/html/index.html b/code/html/index.html index c0a31227..0f4cb90f 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -388,6 +388,17 @@
+
+ + +
+
+
+ This name will be used in Alexa integration.
+
+
+ +