Unable to Connect - Android

Scenario

  • Access to HA via browser is OK
  • Access to HA via HA App is Not OK - results in “Unable to Connect” error message

Background

  • Platform: Android (Samsung Galaxy S22 Ultra, Android v12)
  • Browser: Chrome/Samsung
  • Home Assistant Server: latest (2022.3.7)
  • Home Assistant companion app: latest (2022.3.0-full)
  • Access to HA is via Cloudflared/Argo tunnel
  • HA is behind Nginx Proxy Manager

Checklist

  • Cloudflare Zero trust cannot be used with the app
  • Make sure your homeassistant: settings are right, e.g.
  external_url: "https://ha.YOURDOMAIN.org"
  internal_url: "http://YOURLANIP:8123"
  • Also ensure your http: settings are right, e.g.
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24  # Add the IP address of the proxy server
    - 192.168.2.0/24

Solution

  • The issue was not with cloudfare, nginx or HA
  • The issue was resolved by disabling private DNS on the phone

Disabling Private DNS
Settings → Connections → More Connection Settings → Private DNS → Set to OFF

Hope this helps someone

2 Likes

Thanks for the guide, this was very helpful verifying my HA configuration which is similar to yours. I initially still had issues with connecting to the HA App and reinstalling the HA App did not solve the issues either. However, after clearing all data associated with the HA App (Settings menu of Android phone → Apps → Home Assistant → Storage → Clear data) I was properly redirected to the welcome page of the HA App where I could enter the HA URL again and successfully connect to HA. In my case it wasn’t necessary to set the Private DNS to OFF.

1 Like

I did both steps, disable private DNS, and clear data. Unfortunately, I still can’t connect.

Unable to connect to Home Assistant
Error Code: -8
net::ERR_CONNECTION_TIMED_OUT

I can connect through the browser no problem…

remember the app utilizes APIs that hte browser does not so thats not a fair comparison, you will want to make sure that all HA APIs are not being blocked.

I have the same problem. Using Xiamo Redmi Note 9 - Android 12
If you found a solution, please let me know

It turns out the DNS cache wasn’t flushed. I restarted the phone and eventually it just worked again

I followed the instructions
but it only works 1st time when you restart your phone after when you try to load the app it just vibrates and closes within a sec.

Hey there,

Thanks for the above.

I do not have a url (external address). I used the internal one to connect my phone yesterday, and all was great. Today it gave this “cannot connect” message.

Does one HAVE to have an external url/domain/address to use the app?

If so, fair enough, then I’m stuck for now.

If not, where do I start looking to find out why it stopped working today? I know - very noob question. Started installing and using HA two days ago, so some of the stuff is very new to me.

Sorry. Samsung Galaxy Note8

if you want to access it off your network, yes you need it to be remotely accessible. Otherwise the app will not be able to send data home. You will receive notifications but thats about it.

1 Like

If I don’t care about using it outside the home, how do I disable the request for an external url? Or will it just ignore it?

Using HAOS installed on a VM on Debian 11. Any ideas on why the companion app worked yesterday, but today not? Or at least places to start looking?

just keep the address you want to use as the external one and use the app like that

From the pop-up go to settings and then look at the companion app logs to see if the error is helpful to you. Its more than likely a network error. Have you tried restarting things already?

1 Like

Thanks.

The logs are all gibberish to me. Again…noob :man_facepalming:. I mean, I understand the time and date part of each line in the log :slight_smile: But, the info next to it, presently, has no meaning to me.

Did restart phone. Not VM yet, but will try that. If no joy, will start searching/learning what the logs are all about. :slight_smile:

look for your IP address in a log message that says failed to connect or timeout or something similar…maybe the IP address its trying or got proxied to will give you a clue as to where the issue may be.

def restart the VM, maybe even the host too.

1 Like

Forgive me if I am bugging too much.

I am connected to http://homeassistant.local:8123 from my desktop browser.

But, App on phone does not connect.

I then tried to connect to above address from Chrome browser on phone, and it says site cannot be reached. My thoughts are that something is amiss on the phone?

Message on phone chrome browser
DNS_PROBE_FINISHED_BAD_CONFIG

Does that make any sense to you? It appears somethings wrong with phone’s ability to browse the local network. When I type in an address like cnn.com all seems to work fine.

try the IP address directly instead of that local host name, the DNS error suggests thats probably it

2 Likes

Yeah, that did it. :partying_face:

Thanks a stack!

Funny thing, though. On the VM, it instructs to use homeassistant.local:8123, no ip given, but, just above it, it gives an ip as 10.0.0.163/24 “to be used for enp0s3” - whatever that may be.
This made me assume the ip is 10.0.0.163. It isn’t :slight_smile:

I tried connecting to 10.0.0.163:8123 from the phone - no joy. So I tried from the desktop, to see if address is correct. That’s how I discovered it’s not.

I then did a ping and an arp -a and started down the list of IPs. Found it.

May I ask one more thing? - and thanks a mil for this assist :pray: :+1:

Should I expect that IP to change (as it is dynamic), and I’m assuming that will affect the companion app if it does?

i am not sure, thats more about how you setup your VM…you want to use static IPs locally to avoid that.

1 Like

:+1: :+1:

Thanks for the help.
Much appreciated

1 Like

Pour info j’avais aussi ce problème

Impossible de se connecter à Home Assistant
Code d’erreur : -8
net :: ERR_CONNECTION_TIMED_OUT

J’ai appliqué tous les correctifs mais sans succès.
J’ai fini par trouvé, le problème venait de mon abonnement téléphone, je suis chez bouygues Telecom et ils sont passés en IPV6.
Pour corrigé le problème il m’a juste fallu dans Duckdns supprimé l’adresse IPV6 et laisser seulement l’IPV4

I spent the last couple of hours diagnosing this issue until I found this fix. Thank you for saving me from tearing my hear out!