From dd47c4a1a9fc104397f123bf677056d57d40dbab Mon Sep 17 00:00:00 2001 From: Claude Fable 5 Date: Tue, 28 Jul 2026 16:20:39 +0200 Subject: [PATCH] feat(web): install devices by mDNS name, warn to reserve raw IPs The setup wizard showed a discovered device's mDNS hostname in the scan table but always bound the raw IP into the driver config. Prefer the self-broadcast .local name when the device advertises one, so the connection survives DHCP lease changes; other reverse-DNS names stay display-only since resolving them depends on the router. When the configured host is an IP literal, a live hint under the host field now tells the operator to reserve that IP for the device in the router's DHCP settings. The Settings device help texts carry the same advice. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com> --- .changeset/mdns-first-device-install.md | 9 +++ web/settings/tabs/devices.js | 4 +- web/setup.html | 23 ++++++- web/setup.js | 82 ++++++++++++++++++++----- web/setup.test.mjs | 23 +++++++ 5 files changed, 122 insertions(+), 19 deletions(-) create mode 100644 .changeset/mdns-first-device-install.md diff --git a/.changeset/mdns-first-device-install.md b/.changeset/mdns-first-device-install.md new file mode 100644 index 00000000..0cfb9253 --- /dev/null +++ b/.changeset/mdns-first-device-install.md @@ -0,0 +1,9 @@ +--- +"ftw": patch +--- + +The setup wizard now installs a discovered device by its self-broadcast mDNS +(.local) name instead of its raw IP when the device advertises one, so the +connection survives DHCP lease changes. When only an IP address is used, the +wizard and device settings now tell the operator to reserve that IP for the +device in the router's DHCP settings. diff --git a/web/settings/tabs/devices.js b/web/settings/tabs/devices.js index 07218ec1..9fef2bdb 100644 --- a/web/settings/tabs/devices.js +++ b/web/settings/tabs/devices.js @@ -80,7 +80,7 @@ if (modbus) { html += '
Modbus TCP' + '
' + - '' + + '' + '' + '
' + '' + @@ -145,7 +145,7 @@ // post-render DOM edit mirrors the site-meter pattern above // and avoids a re-render race with the async catalog fetch. html += '
HTTP' + - '' + + '' + '' + '
' + '' + diff --git a/web/setup.html b/web/setup.html index c99ab597..5c4c92f7 100644 --- a/web/setup.html +++ b/web/setup.html @@ -353,6 +353,21 @@ margin: 1rem 0; } + /* ---- Host addressing hint (mDNS name vs fixed IP) ---- */ + .host-hint { + margin: 0 0 1rem; + padding: 10px 12px; + background: var(--ink-raised); + border: 1px solid var(--line); + border-radius: 8px; + font-size: 0.78rem; + color: var(--fg-dim); + line-height: 1.5; + } + + .host-hint.mdns { border-color: color-mix(in srgb, var(--green-e) 45%, var(--line)); } + .host-hint.dhcp { border-color: color-mix(in srgb, var(--yellow) 55%, var(--line)); } + /* ---- Driver picker ---- */ .driver-desc { margin-top: 0.5rem; @@ -595,8 +610,8 @@

Find devices