diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp
index a9c1eccde..712cf2058 100644
--- a/wled00/cfg.cpp
+++ b/wled00/cfg.cpp
@@ -57,10 +57,21 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
#endif
JsonObject id = doc["id"];
- getStringFromJson(cmDNS, id[F("mdns")], 33);
- getStringFromJson(serverDescription, id[F("name")], 33);
+ getStringFromJson(cmDNS, id[F("mdns")], sizeof(cmDNS));
+ // fill in unique mDNS name if not set (cmDNS can be empty meaning no mDNS is used)
+ if (strcmp(cmDNS, DEFAULT_MDNS_NAME) == 0) sprintf_P(cmDNS, PSTR("wled-%*s"), 6, escapedMac.c_str() + 6);
+ getStringFromJson(serverDescription, id[F("name")], sizeof(serverDescription));
+ if (!fromFS) {
+ char hostname[25];
+ prepareHostname(hostname, sizeof(hostname)-1);
+ #ifdef ARDUINO_ARCH_ESP32
+ WiFi.setHostname(hostname);
+ #else
+ WiFi.hostname(hostname);
+ #endif
+ }
#ifndef WLED_DISABLE_ALEXA
- getStringFromJson(alexaInvocationName, id[F("inv")], 33);
+ getStringFromJson(alexaInvocationName, id[F("inv")], sizeof(alexaInvocationName));
#endif
CJSON(simplifiedUI, id[F("sui")]);
@@ -637,8 +648,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
getStringFromJson(mqttUser, if_mqtt[F("user")], 41);
getStringFromJson(mqttPass, if_mqtt["psk"], 65); //normally not present due to security
getStringFromJson(mqttClientID, if_mqtt[F("cid")], 41);
-
+ if (mqttClientID[0] == 0) sprintf_P(mqttClientID, PSTR("WLED-%*s"), 6, escapedMac.c_str() + 6);
getStringFromJson(mqttDeviceTopic, if_mqtt[F("topics")][F("device")], MQTT_MAX_TOPIC_LEN+1); // "wled/test"
+ if (mqttDeviceTopic[0] == 0) sprintf_P(mqttDeviceTopic, PSTR("wled/%*s"), 6, escapedMac.c_str() + 6);
getStringFromJson(mqttGroupTopic, if_mqtt[F("topics")][F("group")], MQTT_MAX_TOPIC_LEN+1); // ""
CJSON(retainMqttMsg, if_mqtt[F("rtn")]);
#endif
diff --git a/wled00/data/settings_wifi.htm b/wled00/data/settings_wifi.htm
index d2d7c66c4..e4a63dd59 100644
--- a/wled00/data/settings_wifi.htm
+++ b/wled00/data/settings_wifi.htm
@@ -144,6 +144,7 @@ Static subnet mask:
function tE() {
// keep the hidden input with MAC addresses, only toggle visibility of the list UI
gId('rlc').style.display = d.Sf.RE.checked ? 'block' : 'none';
+ if (d.Sf.RE.checked) d.Sf.ETH.selectedIndex = 0; // disable Ethernet if ESPNOW is enabled
}
// reset remotes: initialize empty list (called from xml.cpp)
function rstR() {
@@ -176,7 +177,9 @@ Static subnet mask:
rC++;
gId('+').style.display = gId("rml").childElementCount < 10 ? 'inline' : 'none'; // can't append to list anymore, hide button
}
-
+ function vI(i) {
+ i.style.color = (i.value.match(/^[a-zA-Z0-9_\-]*$/)) ? 'white' : 'red';
+ }
@@ -187,6 +190,9 @@ Static subnet mask:
WiFi setup
+ Hostname/mDNS address (empty for no mDNS):
+ http://.local
+ Client IP: Not connected
Connect to existing network
@@ -198,14 +204,10 @@ Static subnet mask:
DNS server address:
...
-
- mDNS address (leave empty for no mDNS):
- http:// .local
- Client IP: Not connected
Configure Access Point
- AP SSID (leave empty for no AP):
+ AP SSID (empty for no AP):
Hide AP name:
- AP password (leave empty for open):
+ AP password (empty for open):
Access Point WiFi channel:
AP opens: