Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(home): tell a LAN address it is a LAN address, not that it needs https

nirholase552787d76ed
diff --git a/src/home/connect.js b/src/home/connect.js
index f41d27f31..f2829c53b 100644
--- a/src/home/connect.js
+++ b/src/home/connect.js
@@ -455,25 +455,20 @@ export function checkReachable(input) {
const raw = String(input || '').trim();
if (!raw) return { ok: true, short: '' };
+ // Parse WITHOUT requireSecure first, then diagnose in order of usefulness.
+ // The order matters more than it looks: the single most common thing a person
+ // pastes is "http://192.168.1.10:8123", which is both plain http AND a LAN
+ // address. Checking the scheme first answers it with "use https", which sends
+ // them off to configure TLS on a machine we still would not be able to reach.
+ // The LAN diagnosis is the true one and the actionable one, so it goes first.
let parsed;
try {
- // requireSecure is the same flag api/home/index.js passes, so the browser
- // and the server agree on what is reachable instead of one of them
- // accepting an address the other will refuse. It exempts loopback, which
- // is how a developer running Home Assistant on this machine still works.
- parsed = normalizeBaseUrl(raw, { requireSecure: true });
+ parsed = normalizeBaseUrl(raw);
} catch (err) {
- const badScheme = /plain http/i.test(err?.message || '');
return {
ok: false,
- short: badScheme ? 'A plain http address cannot be reached from this page.' : 'That is not a web address we can use.',
- notice: badScheme
- ? {
- tone: 'warn',
- title: 'That is a plain http address.',
- body: 'This page is served over https, and a browser will not open an unencrypted connection from it. Use the https address for your house.',
- }
- : { tone: 'error', title: 'That address does not look right.', body: err?.message || 'Use the full https URL of your Home Assistant.' },
+ short: 'That is not a web address we can use.',
+ notice: { tone: 'error', title: 'That address does not look right.', body: err?.message || 'Use the full https URL of your Home Assistant.' },
};
}
@@ -494,6 +489,21 @@ export function checkReachable(input) {
};
}
+ // Past the LAN check, the same rule the server applies with
+ // `requireSecure`: a page on https cannot open a plain-http connection, and
+ // loopback is exempt so a local instance still works in development.
+ if (!parsed.secure && !parsed.loopback) {
+ return {
+ ok: false,
+ short: 'A plain http address cannot be reached from this page.',
+ notice: {
+ tone: 'warn',
+ title: 'That is a plain http address.',
+ body: 'This page is served over https, and a browser will not open an unencrypted connection from it. Use the https address for your house.',
+ },
+ };
+ }
+
return { ok: true, short: '' };
}
diff --git a/tests/e2e/home-connect.spec.js b/tests/e2e/home-connect.spec.js
index 076dfbd7d..cc9dcabc9 100644
--- a/tests/e2e/home-connect.spec.js
+++ b/tests/e2e/home-connect.spec.js
@@ -89,8 +89,12 @@ test.describe('/smart-home connect flow', () => {
await expect(state(page)).toHaveAttribute('data-state', 'empty', { timeout: SLOW });
await expect(page.locator('#hm-url')).toBeVisible();
- // The token instructions are inline: nobody should have to go and search.
- await expect(page.getByText(/long-lived access tokens/i)).toBeVisible();
+ // The token instructions are inline, one disclosure away: nobody should
+ // have to leave the page to find out where Home Assistant hides them.
+ const help = page.getByRole('group').filter({ hasText: /where do i get an access token/i });
+ await expect(help).toBeVisible();
+ await help.getByText(/where do i get an access token/i).click();
+ await expect(help.getByText(/scroll to long-lived access tokens/i)).toBeVisible();
});
test('a private address is refused with no network call at all', async ({ page }) => {