Remote access
Home Assistant answers at https://ha.example.com from anywhere, with a valid certificate, and no port is opened on the router (R7). A small cloudflared container in the home VM dials out to Cloudflare, and Cloudflare sends visitors back down that tunnel to Home Assistant on localhost:8123. Your home address is never published.
The same address serves three uses: the Home Assistant app away from home, your browser, and Claude through Home Assistant’s MCP server at /api/mcp.
Everything here is on Cloudflare’s free plan. Only Home Assistant is published. Everything else (SSH, Grafana, AdGuard, the NAS) is reached through the admin VPN of step 10.11.
What exposing Home Assistant means. Anyone on the internet can reach its login page. Cloudflare hides your address and absorbs scanning, but what stands between the internet and your lights is the Home Assistant login. Step 7.13 gave every account a second factor and turned on the ban after five failed attempts. Check both before step 9.4.
Restore path. The tunnel was created on 2026-11-06 under the name haos, and step 7.5 carried its token over. Steps 9.1 to 9.3 are then checks: confirm each Verify and move on. If cloudflared already runs (ssh home 'docker ps | grep cloudflared'), go straight to step 9.5.
Part A. The domain on Cloudflare
Section titled “Part A. The domain on Cloudflare”9.1 Cloudflare account, and the domain’s records
Section titled “9.1 Cloudflare account, and the domain’s records”Why. A tunnel hostname must live on a domain whose DNS Cloudflare serves. Moving the nameservers copies every record: anything missed (email above all) stops working, so you record the current state first.
- In GoDaddy, My Products > example.com > DNS: screenshot the Nameservers line and the full record list into
~/infra-migration/godaddy-dns.png. Note any MX record (email) and any A or CNAME at@orwww(a website). - Create a free account at dash.cloudflare.com/sign-up. Store it, with its two-factor code, as
Cloudflare accountin theInfrastructurevault. Turn on two-factor sign-in under My Profile > Authentication. - Add a domain:
example.com, Quick scan for DNS records on, plan Free. - Compare the records Cloudflare found with your screenshot. Add what is missing. Set MX records, and anything that is not a website, to DNS only (grey cloud). Delete GoDaddy’s parking records.
- Continue until Cloudflare shows the two nameservers assigned to you.
Verify. The Cloudflare DNS page lists every record of your screenshot except parking records.
Rollback. Delete the domain from Cloudflare. Nothing changed at GoDaddy yet.
9.2 Point the domain at Cloudflare
Section titled “9.2 Point the domain at Cloudflare”Why. This is the only change at GoDaddy, and switching the nameservers back undoes it.
- GoDaddy, DNS > Nameservers > Change Nameservers > I’ll use my own nameservers: enter Cloudflare’s two names, save, confirm with the code GoDaddy sends.
- In Cloudflare, Check nameservers now. Activation takes 10 to 60 minutes, at most a day.
- Once active: SSL/TLS > Edge Certificates > Always Use HTTPS on.
Verify. dig NS example.com +short lists two names ending in ns.cloudflare.com, and Cloudflare shows the domain as Active.
Rollback. GoDaddy, Nameservers > Change > GoDaddy nameservers. GoDaddy still holds the old records.
Part B. The tunnel
Section titled “Part B. The tunnel”9.3 Create the tunnel and its public hostname
Section titled “9.3 Create the tunnel and its public hostname”Why. The tunnel is the outbound connection that replaces a port forward. Its token is the one secret of this setup: whoever holds it can serve your hostname.
- Open one.dash.cloudflare.com. The first visit asks for a team name (anything) and a plan: Free.
- Networks > Tunnels > Create a tunnel > Cloudflared, name
home, Save tunnel. - On the install page, under Docker, copy the long string after
--token(it starts witheyJ). Put it in 1Password at once and clear the clipboard:
op item edit "Cloudflare tunnel home" --vault Infrastructure "credential=$(pbpaste)" >/dev/null && pbcopy < /dev/null- Next, on the Public hostname page: subdomain
ha, domainexample.com, typeHTTP, URLlocalhost:8123. Save.
Verify. op read "op://Infrastructure/Cloudflare tunnel home/credential" | cut -c1-3 prints eyJ. In Cloudflare’s DNS page, a proxied CNAME ha points at <id>.cfargotunnel.com.
Rollback. Delete the tunnel in Networks > Tunnels and the ha record.
9.4 Start the connector
Section titled “9.4 Start the connector”Why. cloudflared runs on the VM’s own network, like Home Assistant, so it reaches Home Assistant at localhost:8123 and Home Assistant sees it as 127.0.0.1, which is exactly the proxy the next step trusts.
Mac Pin its version first: in $INFRA/vm/home/.env.tpl set CLOUDFLARED_VERSION to the newest tag listed on the cloudflared releases.
cd $INFRA && git commit -am "home: pin cloudflared" ; vm-push.sh homessh home 'cd /srv/stack && docker compose --profile remote-access up -d cloudflared && sleep 8 && docker logs cloudflared 2>&1 | grep -c "Registered tunnel connection"'Verify. The command prints 4, and the tunnel shows Healthy in Cloudflare within a minute.
Rollback. ssh home 'cd /srv/stack && docker compose --profile remote-access rm -sf cloudflared'. Home Assistant is off the internet at once and keeps working at home.
9.5 Home Assistant trusts the tunnel and knows its public name
Section titled “9.5 Home Assistant trusts the tunnel and knows its public name”Why. Without this, Home Assistant answers 400 Bad Request through the tunnel, and Claude’s sign-in fails on an address mismatch. Since Home Assistant 2026.11 these settings live in the interface. Never add an http: block to configuration.yaml: it is ignored and raises a repair.
In Home Assistant, Settings > System > Network:
- HTTP server: Trust X-Forwarded-For on. Trusted proxies:
127.0.0.1and::1. - Home Assistant URL > Internet:
https://ha.example.com, no trailing slash. Local network stayshttp://10.0.5.2:8123. - Save. Home Assistant restarts. Sign in and confirm the settings within five minutes, or it reverts.
Verify. grep -c "untrusted proxy" /Volumes/config/home-assistant.log prints 0 after the next step’s tests.
Rollback. Clear the Internet URL, turn Trust X-Forwarded-For off, save.
9.6 Test from outside
Section titled “9.6 Test from outside”Why. The test that counts comes from a device that is not on your network.
- iPhone, Wi-Fi off: open
https://ha.example.com. The login page shows a padlock, and signing in works, with the six-digit code. Mac
curl -sI https://ha.example.com/api/mcp | head -1 # HTTP/2 401: reached, and asked for authenticationcurl -s -o /dev/null -w '%{http_code}\n' https://ha.example.com/manifest.json # 200Verify. Both answers match.
Rollback. Step 9.4’s rollback.
Part C. Keep it safe, then use it
Section titled “Part C. Keep it safe, then use it”9.7 Cloudflare’s free protections
Section titled “9.7 Cloudflare’s free protections”Why. They cut the background noise before it reaches the login page. One tempting feature stays off: Cloudflare Access in front of the hostname would break the Home Assistant app, Home Assistant’s own OAuth flow and Claude, which all need to reach it without a second login.
In Cloudflare, for the domain:
- Security > Bots: Bot Fight Mode on.
- Security > WAF > Custom rules > Create rule, name
ha geo: when Hostname equalsha.example.comand Country is not in {Canada, United States}, action Block. Claude’s servers are in the United States and must stay allowed. Add a country before you travel there. - Network: WebSockets on (the dashboard needs it).
In Home Assistant, re-check Settings > System > Network > HTTP server: IP banning on, unlimited attempts off, 5 attempts.
Verify. From the Mac, six wrong passwords in a row on the public address end with a ban notice in Home Assistant, and /Volumes/config/ip_bans.yaml lists the address. Delete that file’s entry and restart Home Assistant to lift your own ban.
Rollback. Delete the WAF rule. Turn Bot Fight Mode off.
9.8 The Home Assistant app away from home
Section titled “9.8 The Home Assistant app away from home”Why. With the external address set, the app keeps reporting location when you are out, so presence no longer leans on iCloud alone.
On each phone, Home Assistant app > Settings > Companion app > your server: External URL https://ha.example.com. Keep the internal URL, and list your home Wi-Fi name under Internal connection so the app uses the local address at home.
Verify. With Wi-Fi off, the app loads the dashboard.
Rollback. Clear the External URL.
9.9 Connect Claude
Section titled “9.9 Connect Claude”Why. Claude reaches Home Assistant from Anthropic’s cloud, which is why a public HTTPS address was needed. The sign-in is Home Assistant’s own OAuth login: no long-lived token is created or stored.
- In Home Assistant, Settings > Devices & services: the Model Context Protocol Server integration is present (add it if not). Keep its defaults: admin account required, all AI tools exposed.
- In Claude (desktop Settings > Connectors, or claude.ai/settings/connectors): Add custom connector. Name
Home Assistant, URLhttps://ha.example.com/api/mcp, authentication Sign in now, OAuth client Use Claude’s published identity. Add, then Connect, and sign in with your Home Assistant admin account. - For Claude Code on the Mac:
claude mcp add --transport http home-assistant https://ha.example.com/api/mcpclaude mcp login home-assistantVerify. In a new chat with the connector enabled, “which lights are on?” returns the real state.
Rollback. Remove the connector in Claude. In Home Assistant, your profile > Security lists the granted session: delete it.
Troubleshooting
Section titled “Troubleshooting”| What you see | Cause | Fix |
|---|---|---|
| Cloudflare error 1033 or 530 | cloudflared is not connected |
ssh home 'docker logs cloudflared'. Check the token in 1Password, push again |
| Cloudflare error 502 or 1016 | The connector is up but cannot reach Home Assistant | The public hostname must be HTTP localhost:8123 |
400 Bad Request from Home Assistant |
The proxy is not trusted | Step 9.5 |
| Claude’s sign-in redirects to 10.0.5.2 | The Internet URL does not match | Step 9.5, item 2 |
| Claude asks for a client secret | Wrong choice in the connector form | Use Claude’s published identity |
| The login page loads, the dashboard spins | WebSockets blocked | Step 9.7, item 3 |
| Email on the domain stopped | An MX record is missing or proxied | Add it as GoDaddy had it, DNS only |
Result
Section titled “Result”Home Assistant is reachable from anywhere over HTTPS through Cloudflare, behind its own login with a second factor and a ban on repeated failures. The phones’ apps and Claude use that one address. The router still has no forwarded port.