home-assistant / home-assistant/iOS

Connection instability when switching between LAN, VPN, and Nabu Casa remote access

Open
#4,605 4 comments 0 reactions 0 assignees View on GitHub
bug ios
Dominant language
Swift
Stars
2.4k
Forks
520
Avg merge
7h 27m
Merged PRs (30d)
264

Description

I wanted to report an issue I encountered with the Home Assistant iOS app related to connection handling when using a single server configuration with both local and Nabu Casa access.

**Environment:**

- Home Assistant OS
- Core: 2026.4.4
- Supervisor: 2026.04.2
- Frontend: 20260325.8
- iOS Companion App: 2026.4.1 (2026.1904)
- iOS: 26.4.2

**Issue:**
When using a single server entry (with both internal and external URLs), the app had difficulty switching between local (LAN/VPN) and remote (Nabu Casa) connections. I experienced:

- App getting stuck on “Connecting” or losing connection
- WebSocket failing to establish or reconnect reliably
- Login/auth webview occasionally failing to hand off back to the app
- In some cases requiring app restart or even device restart to recover
- Inconsistent behavior when switching between LAN, VPN, and remote access

Browser access (both local and via Nabu Casa) worked consistently, so the issue appears isolated to the mobile app’s connection/session handling.

**Workaround (Resolved):**
I created two separate server entries in the iOS app:

- One using the local URL (LAN)
- One using Nabu Casa (remote)

With this setup:

- The app reliably selects the correct endpoint based on reachability
- WebSocket connections remain stable
- No more connection drops or login issues
- No need to restart the app or device

**Feedback:**
It seems the auto-switching logic within a single server configuration may cause instability in environments with:

- VPN usage
- frequent network changes (LAN ↔ WAN)
- larger or more active HA setups

You may want to review:

- WebSocket reconnection handling
- auth handoff from webview → native app
- internal vs external URL switching logic within a single server profile

Happy to provide logs or test further if helpful.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.