Internet down, companion app not connecting

I’m wondering if I have something misconfigured?
At home, using HA companion app on an Android 16, wifi connected, all on the same LAN. Then the internet drops out (provider fault) and suddenly I can’t access HA.

On the phone, I can see wifi is still connected (without internet) but reopening the app gives the ‘insecure connection blocked’ - same as if trying to connect from outside the LAN.
However, my Android tablet (no sim, wifi only) remained connected to HA via the companion app. So, I put the phone in airplane mode and it connected (via the app).

Can someone explain what’s happening with this? Is there a config setting I should adjust. My expectation is that internet connectivity should be irrelevant when locally connected.

In the Companion App, check the server settings to ensure you have both an Internal and External address set. The Internal will most likely be http://[ip address]:8123 (ie. not secure) and the external https://[domain name]

note: I used the older 8123 port in the not secure that was recently changed to port 80

Thanks SJ - the external address is blank because, if outside the LAN, I use a VPN to connect (VPN client on the phone connects to the fixed IP of my router’s VPN server).

The internal address is, as you say, http://[ip address]:8123.

The app server settings are the same on the phone and the tablet but the tablet connected while the phone did not (until I put it in airplane mode).

It sounds like the phone realizes that there’s no Internet route via wifi, so it stops using wifi completely (even for the local wifi subnet) and sends everything via the cellular interface…

Yes, that appears to be what’s happening even though packets are destined for the LAN, not the internet. Airplane mode kills the cellular connection to the internet - and then packets are routed to the HA server (cabled ethernet connection to a cisco switch, as it the router).

What should happen:
Phone (wifi) router (ethernet) switch (ethernet) HA.
Internet connectivity should be irrelevant.

That is crazy! I am surprised that Android doesn’t simply auto-detect the unavailable routes like iOS…

Try putting your phone in “Airplane mode with WIFI”.

On Android I think you just enable airplane mode then turn WIFI back on.

If the phone only has 1 network connection that may solve the issue.

Thanks for your thoughts.
Yes, crazy - certainly unexpected.
Airplane mode is a work-around for the issue but I’m still wondering why internet connectivity (or the lack of it) at the router makes any difference.

Short answer: Abundance of choice.

A lot of code (both in applications and in operating systems) is only written to try one way of connecting. If a device has multiple options and it picks a bad one (which fails) then the you see an error.

When you remove all other choices - so there is only one choice (a good choice) then the device can’t pick a bad choice, so it connects.

This really comes down to the definition of “locally connected”.
When at home, a phone typically has two connections (WIFI and Cell/5G/etc).

If the phone can confirm that it can connect to the wider internet via WIFI then it can choose to send all traffic via WIFI.

Bluntly, if the phone can see WIFI, but can’t use it to get to the rest of the internet (because the ISP is down) is it really “locally connected” ? **

** - This isn’t a question of reality, it is a question of what the phone believes to be true and how it will respond based on that.

TL;DR - If the phone has a good 5G/Cell connection it will likely send all traffic out over that, since the traffic can’t get back to your local network (via the ISP) you won’t be able to connect to Home Assistant.

I cannot agree with that. The phone’s Wi-Fi is a network interface with an assigned address, and standard network switching involves using that specific interface for addresses belonging to that specific network.

There is also a second point, not technical, but important: mobile data costs money, whereas Wi-Fi does not. A phone cannot simply “decide” at random to use mobile data instead of Wi-Fi.

On an iPhone, if I connect to a Wi-Fi network that lacks internet access (e.g., to configure a Shelly device on the 192.168.33.X network), the phone asks if it should start using mobile data for internet connectivity. However, regardless of the answer, this has no impact on connections to 192.168.33.X addresses, as that would make no sense.

What if you put the LAN IP in the 'Home Assistant URL" where the external address should go?

Yes, I agree @slimak, there is no traffic into the internet via the cellular network whilst wifi is enabled.

Interesting thought, @Nick4. I should have some time to do testing tomorrow - I’ll include your suggestion. I suspect it won’t help (but I’ve been wrong before :))