Android APP "Unable to connect to Home Assistant"

Have the same problem since a couple of days the app doesn’t connect anymore, OnePlus 6T fully updated.

I requested a new certificate from Let’s Encrypt because of this https://twitter.com/letsencrypt/status/1443621997288767491 but doesn’t help. Might still be related? As I can connect via internal URL?

BTW using my own domain, and HAproxy on OPNsense.

Same here, with two devices.
After re-generating all the Let’s Encrypt stuff, I also had to completely reinstall the Android app from scratch. Also had to use a different Device Name in the app, which registered itself as new in HA.

@robi
and does it work now? I am still having trouble and can’t connect to HA in the app. Working via browser with wireguard instead.

Yes it does.

I was regenerated my certificate with DuckDNS, I checked that certificate on browser, cleared storage for HA app and Chrome and it still doesn’t work :frowning:

Hi!
I had the same problem up until now.
For me it was actually simple.
The IP address of the home assistant app was no longer correct.
Windows: Go to CMD> “tracert homeassistant.local”
HA app: Settings> Change IP address to the one you just found out.
Hope that solves your problem, too, I just registered here for it. :slight_smile:

2 Likes

Unfortunately in my case this is not a problem. Locally I have static IP for HA set on router.

I have the same issue and I have tried lots of things that still do not work companion app on my Galaxy note 5.

I finally fixed this issues thanks to @dshokouhi.

For me, it was a data setting in my app info. The mobile data and wifi. “Wifi data” and “disable data usage” somehow got turned on. As soon as I toggled them off, the app has started working as normal

1 Like

I am having the same issue as many described it here that the android app is not able to connect outside local network while the Web version works perfectly fine. Webview is enabled and up to date, troubleshooting docs are not helpful since everything described is fulfilled.

Logo ut while in the local network and log in while outside the local network seem to make it working correctly again.

I was having this issue with an android phone I use as an IP camera, so I had disabled all apps, including chrome. Enabling chrome did the job. Thanks

this makes sense becasue the app does depend on chrome and/or webview, even googles own troubleshooting says not to disable them

1 Like

Many thanks! That solved my issue!

all these comments/ answer … no solution is that a joke or community of lamers?

There is no single answer to give, everyone has their own unique issue as you can see from above. What is your issue and what troubleshooting steps have you tried?

@dshokouhi i never heard such a nonsense statement, sorry.

I changed main router; added exactly same port forward as on old router and it STOPPED to work.

I can access hass from localy connected devices via local ip only, from locally connected devices i cant access it via publicdomain:port; if i connect device to different public ip i can access Hass via its publick ip:port …

this is completely most idiotic behavior i ever saw. even the core is messed up/ ngnix or i have no clue what a crap is that.

The post above yours said they solved the issue by enabling chrome, another post above that a user mentioned they had to enable data access to the app. How are those not considered unique issues?

Asking a user to say what their issue is and what troubleshooting steps they have tried is not a “nonsense statement” either.

As to your issue, its not app related if you can’t login with a browser as you mentioned. Considering that it was working previously and all you did was change hardware the issue is most likely due to router/network configuration.

This troubleshooting page may be of help (which was linked to earlier in this thread):

the conclusion is following:
The new router does not support NAT loopback (hairpinning).

solved via DNS server confi file update

The unable to connect issue started for me yesterday. It was either caused by:

  • Updating HassOS to v7
  • Updating Hass Core to 2021.12
  • Applying Android 12 December security patch to my pixel 5.

I cannot connect anymore when I’m on my wifi, both internal & external url fail. Connecting over celular data coming in “from the outside” works.
On my Tablet (Android 10), the Hass Android app works without a problem. It even makes use of the new 2021.12 feature to use a user that can only access the internal url. On the Pixel 5 app I use a different user, that is allowed to access externally.

Both have the same latest beta version of the companion app.

This is the error in the webview behind the error pop-up:

Web page not available

The web page at http://<internal_domain>:8123/?external_auth=1 could not be loaded because:

net::ERR_NAME_NOT_RESOLVED

And this is (I the the relevant snippets) from my app log:

12-16 08:13:20.824 16322 16348 D WebSocketRepository: Sending message number 2: {type=get_config, id=2}
12-16 08:13:20.835 16322 16322 I WM-SystemFgDispatcher: Started foreground service Intent { act=ACTION_START_FOREGROUND cmp=io.homeassistant.companion.android/androidx.work.impl.foreground.SystemForegroundService (has extras) }
12-16 08:13:20.844 16322 16322 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 08:13:20.844 16322 16322 D UrlRepository: Using internal URL
12-16 08:13:22.198 16322 16322 D WebviewActivity: Authentication successful, unlocking app
12-16 08:13:22.231 16322 16322 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 08:13:22.231 16322 16322 D UrlRepository: Using internal URL
12-16 08:13:22.551 16322 16382 E WebSocketRepository: Websocket: onFailure
12-16 08:13:24.560 16322 16348 E IntegrationRepository: Issue getting new version from core.
12-16 08:13:24.564 16322 16351 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 08:13:24.564 16322 16351 D UrlRepository: Using internal URL
12-16 08:13:24.567 16322 16382 E WebSocketRepository: Websocket: onFailure
12-16 08:13:24.568 16322 16322 E WebviewActivity: onReceivedHttpError: errorCode: -2 url:http://<internal domain:port>/?external_auth=1
12-16 08:13:24.568 16322 16387 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 08:13:24.568 16322 16387 D UrlRepository: Using internal URL
12-16 08:13:24.570 16322 16351 E IntegrationRepository: Issue getting new version from core.

When pressing “Refresh External URL” (still via internal LAN) I get:

12-16 09:02:23.303 24009 24009 D UrlRepository: Using external URL
12-16 09:02:23.308 24009 24049 D OpenGLRenderer: endAllActiveAnimators on 0xb4000070ea16dba0 (RippleDrawable) with handle 0xb400006ffa1aa010
12-16 09:02:23.338 24009 24009 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 09:02:23.338 24009 24009 D UrlRepository: Using internal URL
12-16 09:02:23.711 24009 24143 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 09:02:23.711 24009 24143 D UrlRepository: Using internal URL
12-16 09:02:25.723 24009 24009 E WebViewPresenterImpl: Unable to retrieve external auth
12-16 09:02:25.730 24009 24009 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 09:02:25.730 24009 24009 D UrlRepository: Using internal URL
12-16 09:02:25.734 24009 24009 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 09:02:25.906 24009 24143 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 09:02:25.906 24009 24143 D UrlRepository: Using internal URL
12-16 09:02:25.907 24009 24009 E WebViewPresenterImpl: Unable to retrieve external auth

I didn’t change anything about my network. So my hunch is it’s either an issue with 2021.12 of HassOS 7…?

It’s not NAT loopback issue, as this is enabled by default on my USG.

When I replace my internal url with the ip address instead of the hostname, it works.
However I have no issue whatsoever to reach Hass internally via its internal hostname via anyother browser/device and as said the Android companion app on a different device.

Mmm, the internal hostname url also doesn’t work in a browser on the same device. When using a different device on the same network and wifi AP it works fine. So now I suspect the latest Android 12 update…

In the browser I get this error:

This site can't be reached

<internal hostname>'s DNS address could not be found. Diagnosing the problem.

DNS_PROBE_POSSIBLE

An Nslookup in a commandline window in Windows resolves the internal hostname just fine.
The DNS in Android is configured correctly too, it’s the gateway address of the vlan (x.x.x.1 of the vlan subnet).