Android APP "Unable to connect to Home Assistant"

the stack traces themselves are missing here so the actual issue is not known all we know is that its failing to obtain the authentication. Anything else special about your setup? Are you using a proxy?

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 09:02:25.907 24009 24009 E WebViewPresenterImpl: Unable to retrieve external auth

really important to know why it cant authenticate as that answer is held in the stacktraces themselves

I am on a pixel 6 pro on android 12 and do not have this issue.

1 Like

How do I retrieve the stack trace? It’s probably somewhere in this thread. I’ll look it up.

It’s not a Hass issue I’m sure now, as as of that same moment in time I cannot retrieve any other local hostname anymore from this Android device. Also my wife’s Pixel 3 apparently has the same issue. My Android 10 Lenovo tablet, works without a problem.

the stacktraces are in the app configuration logs, same place you pulled the logs.

Ah I see, I fear there’s nothing interesting in there. Here’s an example of a full log after a failed try to open a dashboard in the app:

--------- beginning of main
12-16 17:16:50.970  4783  4783 E mpanion.androi: Not starting debugger since process cannot load the jdwp agent.
12-16 17:16:50.972  4783  4783 D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
12-16 17:16:50.990  4783  4783 D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10271; state: ENABLED
12-16 17:16:51.046  4783  4783 W mpanion.androi: Entry not found
12-16 17:16:51.047  4783  4783 W mpanion.androi: Entry not found
12-16 17:16:51.047  4783  4783 W mpanion.androi: Entry not found
12-16 17:16:51.047  4783  4783 W mpanion.androi: Entry not found
12-16 17:16:51.050  4783  4783 W mpanion.androi: JIT profile information will not be recorded: profile file does not exist.
12-16 17:16:51.050  4783  4783 W mpanion.androi: JIT profile information will not be recorded: profile file does not exist.
12-16 17:16:51.050  4783  4783 W mpanion.androi: JIT profile information will not be recorded: profile file does not exist.
12-16 17:16:51.050  4783  4783 W mpanion.androi: JIT profile information will not be recorded: profile file does not exist.
12-16 17:16:51.055  4783  4783 V GraphicsEnvironment: ANGLE Developer option for 'io.homeassistant.companion.android' set to: 'default'
12-16 17:16:51.056  4783  4783 V GraphicsEnvironment: ANGLE GameManagerService for io.homeassistant.companion.android: false
12-16 17:16:51.057  4783  4783 V GraphicsEnvironment: Updatable production driver is not supported on the device.
12-16 17:16:51.058  4783  4783 D NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: false
12-16 17:16:51.058  4783  4783 D NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: false
12-16 17:16:51.064  4783  4783 I FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
12-16 17:16:51.072  4783  4783 I FirebaseInitProvider: FirebaseApp initialization successful
12-16 17:16:51.073  4783  4783 D WM-WrkMgrInitializer: Initializing WorkManager with default configuration.
12-16 17:16:51.079  4783  4818 I DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:55 and remote module com.google.android.gms.measurement.dynamite:59
12-16 17:16:51.079  4783  4818 I DynamiteModule: Selected remote version of com.google.android.gms.measurement.dynamite, version >= 59
12-16 17:16:51.080  4783  4818 V DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
12-16 17:16:51.080  4783  4783 D Sentry  : io.sentry.auto-init read: false
12-16 17:16:51.080  4783  4783 I Sentry  : Retrieving auto-init from AndroidManifest.xml
12-16 17:16:51.085  4783  4821 D CompatibilityChangeReporter: Compat change id reported: 160794467; UID 10271; state: ENABLED
12-16 17:16:51.088  4783  4818 W mpanion.androi: ClassLoaderContext type mismatch. expected=PCL, found=DLC (PCL[] | DLC[];PCL[/data/app/~~W4AnAvUVTUHY8OaRmuj2Sg==/io.homeassistant.companion.android-WYoyStYDuyxPr6Ff9dqI4g==/base.apk*1399441106:/data/app/~~W4AnAvUVTUHY8OaRmuj2Sg==/io.homeassistant.companion.android-WYoyStYDuyxPr6Ff9dqI4g==/base.apk!classes2.dex*3965918447:/data/app/~~W4AnAvUVTUHY8OaRmuj2Sg==/io.homeassistant.companion.android-WYoyStYDuyxPr6Ff9dqI4g==/base.apk!classes3.dex*1589194302:/data/app/~~W4AnAvUVTUHY8OaRmuj2Sg==/io.homeassistant.companion.android-WYoyStYDuyxPr6Ff9dqI4g==/base.apk!classes4.dex*3880881534])
12-16 17:16:51.106  4783  4841 D Sentry  : SU isn't found on this Device.
12-16 17:16:51.105  4783  4783 W pool-13-thread-: type=1400 audit(0.0:2614): avc: denied { read } for name="version" dev="proc" ino=4026531958 scontext=u:r:untrusted_app:s0:c15,c257,c512,c768 tcontext=u:object_r:proc_version:s0 tclass=file permissive=0 app=io.homeassistant.companion.android
12-16 17:16:51.123  4783  4783 I WebViewFactory: Loading com.google.android.webview version 96.0.4664.104 (code 466410434)
12-16 17:16:51.143  4783  4783 I cr_WVCFactoryProvider: Loaded version=96.0.4664.104 minSdkVersion=29 isBundle=true multiprocess=true packageId=2
12-16 17:16:51.144  4783  4838 I FA      : App measurement initialized, version: 50018
12-16 17:16:51.144  4783  4838 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
12-16 17:16:51.144  4783  4838 I FA      : To enable faster debug mode event logging run:
12-16 17:16:51.144  4783  4838 I FA      :   adb shell setprop debug.firebase.analytics.app io.homeassistant.companion.android
12-16 17:16:51.151  4783  4783 I cr_LibraryLoader: Successfully loaded native library
12-16 17:16:51.151  4783  4783 I cr_CachingUmaRecorder: Flushed 7 samples from 7 histograms.
12-16 17:16:51.173  4783  4838 I FA      : Tag Manager is not found and thus will not be used
12-16 17:16:51.180  4783  4783 W mpanion.androi: Accessing hidden method Landroid/content/res/Resources$Theme;->getKey()Landroid/content/res/Resources$ThemeKey; (max-target-o, reflection, denied)
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: QUALCOMM build                   : 4783c89, I46ff5fc46f
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Build Date                       : 11/30/20
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: OpenGL ES Shader Compiler Version: EV031.31.04.01
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Local Branch                     : QPR2
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Remote Branch                    : 
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Remote Branch                    : 
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Reconstruct Branch               : 
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Build Config                     : S P 10.0.4 AArch64
12-16 17:16:51.192  4783  4839 I AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
12-16 17:16:51.192  4783  4839 D hw-ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
12-16 17:16:51.194  4783  4839 I AdrenoGLES-0: PFP: 0x016dd093, ME: 0x00000000
12-16 17:16:51.199  4783  4839 W AdrenoUtils: <ReadGpuID_from_sysfs:197>: Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model
12-16 17:16:51.199  4783  4839 W AdrenoUtils: <ReadGpuID:221>: Failed to read chip ID from gpu_model. Fallback to use the GSL path
12-16 17:16:51.206  4783  4839 D hw-ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
12-16 17:16:51.216  4783  4783 D SensorReceiver: Sensor audio_sensor corresponding to received event android.media.RINGER_MODE_CHANGED is disabled, skipping sensors update
12-16 17:16:51.220  4783  4783 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:51.220  4783  4783 D UrlRepository: Using internal URL
12-16 17:16:51.225  4783  4783 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:51.227  4783  4826 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:51.239  4783  4825 D SensorWorker: Updating all Sensors.
12-16 17:16:51.241  4783  4834 I WM-Processor: Moving WorkSpec (a3694cc2-a97a-469d-92bf-678faae96bb3) to the foreground
12-16 17:16:51.259  4783  4918 D LocBroadcastReceiver: Registering for zone based location updates
12-16 17:16:51.261  4783  4918 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:51.307  4783  4824 D NextAlarm: No alarm is scheduled, sending unavailable
12-16 17:16:51.347  4783  4783 D CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10271; state: ENABLED
12-16 17:16:51.350  4783  4824 D SensorReceiver: Nothing to update
12-16 17:16:51.362  4783  4824 D LocBroadcastReceiver: Registering for location updates.
12-16 17:16:51.371  4783  4825 D NextAlarm: No alarm is scheduled, sending unavailable
12-16 17:16:51.381  4783  4783 D RenderScript HIDL Adaptation: IRenderScriptDevice::getService()
12-16 17:16:51.390  4783  4825 D SensorReceiver: Nothing to update
12-16 17:16:51.391  4783  4821 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=a3694cc2-a97a-469d-92bf-678faae96bb3, tags={ io.homeassistant.companion.android.sensors.SensorWorker } ]
12-16 17:16:51.408  4783  4783 D RenderScript HIDL Adaptation: IRenderScriptDevice::getService() returned 0xb4000076c9e30420
12-16 17:16:51.408  4783  4783 D RenderScript HIDL Adaptation: HIDL successfully loaded.
12-16 17:16:51.409  4783  5019 E RenderScript: Failed loading RS driver: dlopen failed: library "libRSDriver_adreno.so" not found
12-16 17:16:51.409  4783  5019 E RenderScript: Failed to load runtime libRSDriver_adreno.so, loading default
12-16 17:16:51.417  4783  4783 D mpanion.androi: Successfully queried cache dir: /data/user_de/0/io.homeassistant.companion.android/code_cache
12-16 17:16:51.417  4783  4783 D RenderScript: Setting cache dir: /data/user_de/0/io.homeassistant.companion.android/code_cache
12-16 17:16:51.421  4783  4783 I System.out: recordForce value 5
12-16 17:16:51.421  4783  4783 D WebviewActivity: Current webview package com.google.android.webview and version 96.0.4664.104
12-16 17:16:51.437  4783  4832 E WM-WorkerWrapper: Didn't find WorkSpec for id a3694cc2-a97a-469d-92bf-678faae96bb3
12-16 17:16:51.471  4783  4783 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 17:16:51.476  4783  4783 I WM-SystemFgDispatcher: Stopping foreground service
12-16 17:16:51.502  4783  4825 D SensorWorker: Updating all Sensors.
12-16 17:16:51.503  4783  4834 I WM-Processor: Moving WorkSpec (ee8b67da-b1c4-4859-9e51-82bb31609d4c) to the foreground
12-16 17:16:51.515  4783  4783 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
12-16 17:16:51.526  4783  4783 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
12-16 17:16:51.530  4783  4783 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 17:16:51.531  4783  4783 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:51.531  4783  4783 D UrlRepository: Using internal URL
12-16 17:16:51.567  4783  4783 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
12-16 17:16:51.587  4783  4825 D NextAlarm: No alarm is scheduled, sending unavailable
12-16 17:16:51.607  4783  4825 D SensorReceiver: Nothing to update
12-16 17:16:51.608  4783  4821 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=ee8b67da-b1c4-4859-9e51-82bb31609d4c, tags={ io.homeassistant.companion.android.sensors.SensorWorker } ]
12-16 17:16:51.613  4783  4783 I WM-SystemFgDispatcher: Stopping foreground service
12-16 17:16:53.071  4783  4792 I mpanion.androi: Background young concurrent copying GC freed 172777(8789KB) AllocSpace objects, 58(1928KB) LOS objects, 93% free, 6651KB/102MB, paused 337us,47us total 103.261ms
12-16 17:16:53.688  4783  4783 D LocBroadcastReceiver: Received geofence update.
12-16 17:16:53.693  4783  4783 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:53.728  4783  4783 D LocBroadcastReceiver: Event sent to Home Assistant
12-16 17:16:53.729  4783  4783 D LocBroadcastReceiver: Last Location: 
12-16 17:16:53.729  4783  4783 D LocBroadcastReceiver: Coords:(52.1051224, 5.1149872)
12-16 17:16:53.729  4783  4783 D LocBroadcastReceiver: Accuracy: 16.337
12-16 17:16:53.729  4783  4783 D LocBroadcastReceiver: Bearing: 117.47831
12-16 17:16:53.729  4783  4783 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
12-16 17:16:53.729  4783  4783 D LocBroadcastReceiver: Received location that is 2729 milliseconds old, 1639671411000 compared to 1639671413729 with source fused
12-16 17:16:53.733  4783  4825 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:53.772  4783  4825 D LocBroadcastReceiver: Location update sent successfully
12-16 17:16:54.441  4783  4783 D WebviewActivity: Authentication successful, unlocking app
12-16 17:16:54.473  4783  4783 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:54.474  4783  4783 D UrlRepository: Using internal URL
12-16 17:16:55.374  4783  4783 E WebviewActivity: onReceivedHttpError: errorCode: -2 url:http://<local hostname>:8123/?external_auth=1
12-16 17:16:55.378  4783  4783 D UrlRepository: localUrl is: true and usesInternalSsid is: true
12-16 17:16:58.741  4783  4839 D OpenGLRenderer: endAllActiveAnimators on 0xb400007759e4a610 (RippleDrawable) with handle 0xb400007669e3a230
12-16 17:16:58.769  4783  4783 D UrlRepository: Using external URL
12-16 17:16:58.769  4783  4783 D UrlRepository: Using external URL
12-16 17:16:58.770  4783  4783 D UrlRepository: Using internal URL
12-16 17:16:58.770  4783  4783 D UrlRepository: Using internal URL
12-16 17:16:58.851  4783  4825 D SensorWorker: Updating all Sensors.
12-16 17:16:58.853  4783  4834 I WM-Processor: Moving WorkSpec (b347eea5-21e8-4ef3-941b-6a26740ebb0c) to the foreground
12-16 17:16:58.868  4783  4783 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 17:16:58.896  4783  4783 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
12-16 17:16:58.902  4783  4825 D NextAlarm: No alarm is scheduled, sending unavailable
12-16 17:16:58.912  4783  4825 D SensorReceiver: Nothing to update
12-16 17:16:58.913  4783  4837 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=b347eea5-21e8-4ef3-941b-6a26740ebb0c, tags={ io.homeassistant.companion.android.sensors.SensorWorker } ]
12-16 17:16:58.914  4783  4783 I WM-SystemFgDispatcher: Stopping foreground service
12-16 17:17:05.026  4783  4825 D LogcatReader: Read logcat for pid 4783
12-16 17:17:05.062  4783  4825 D LogcatReader: Done reading logcat for pid 4783
12-16 17:17:51.042  4783  4783 D LocBroadcastReceiver: Received location update.
12-16 17:17:51.043  4783  4783 D LocBroadcastReceiver: Last Location: 
12-16 17:17:51.043  4783  4783 D LocBroadcastReceiver: Coords:(52.1051224, 5.1149872)
12-16 17:17:51.043  4783  4783 D LocBroadcastReceiver: Accuracy: 16.337
12-16 17:17:51.043  4783  4783 D LocBroadcastReceiver: Bearing: 117.47831
12-16 17:17:51.043  4783  4783 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
12-16 17:17:51.043  4783  4783 D LocBroadcastReceiver: Received location that is 35 milliseconds old, 1639671471008 compared to 1639671471043 with source fused
12-16 17:17:51.044  4783  4783 D LocBroadcastReceiver: Duplicate location received, not sending to HA
12-16 17:17:51.059  4783  4783 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
12-16 17:18:06.591  4783  4783 D androidtc: Initializing SystemTextClassifier, type = System
12-16 17:18:06.593  4783  4783 W androidtc: TextClassifier called on main thread
12-16 17:18:06.594  4783  4783 D androidtc: Initializing SystemTextClassifier, type = System
12-16 17:18:07.203  4783  4783 W androidtc: TextClassifier called on main thread
12-16 17:18:07.292  4783  4783 I Choreographer: Skipped 31 frames!  The application may be doing too much work on its main thread.
12-16 17:18:08.106  4783  4783 W androidtc: TextClassifier called on main thread
12-16 17:18:08.316  4783  4783 D androidtc: Initializing SystemTextClassifier, type = System
12-16 17:18:08.318  4783  4783 W androidtc: TextClassifier called on main thread
12-16 17:18:08.318  4783  4783 D androidtc: Initializing SystemTextClassifier, type = System
12-16 17:18:08.740  4783  4783 W androidtc: TextClassifier called on main thread
12-16 17:18:09.285  4783  4825 D LogcatReader: Read logcat for pid 4783

I’m also having trouble to get the HA Android app working correctly. I’ve set up everything to work with https enabled. If I connect to my instance via desktop computer on chromium everything works fine. Even when I connect locally to https://IP-ADDRESS:8123.

The only thing that makes me sick is the connection issue with the Android app. I can connect to my instance https://domain:8123 without any problems.
When the app is open I can see a message at the bottom of the screen “reconnecting” about 5 times then the connection gets killed and I only have the “Retry” screen. From then on a reconnection isn’t possible.
This works once after every re-installation of the app.

In my HA settings panel I can see an access token ist generated for every reconnection from the app and it seems to be a different IP Adress every time.

In my configuration.yaml the http-integration is set up to NOT use ip_ban!

Any ideas on this??

Thanks!

1 Like

That’s your problem right there. SSL certificate is not valid locally is only valid with the registered domain. The app does not bypass certificate errors or warnings.

OK, understand. But that doesn’t explain why on https://domain:8123 it’s disconnecting after about 30s.

I found a solution for my problem on Android:

I used Bromite WebView (an ungoogled WebView implementation) on my phone.
After switching to original Google WebView implementation the app doesn’t disconnect anymore and now works without interruption!

Solved for me :wink:

we have several closed bugs regarding Bromite alone. Unfortunately there is no easy way for the app to detect its usage as it masks itself as valid webview. Glad you figured it out.

Me too :wink:
Did almost uninstall home assistant and let it be.

Better this way!

Hi dshokouhi,

can you tell me if it’s the same with Ungoogled Chromium WebView or Chromium WebView? I want to make use of an alternative WebView because my devices’ WebView Implementation is from April '19.

Thanks

You must use Google version of webview

my tracert (or ping) command does not return IPv4 address, it returns something like [fe80::e91f:3da6:7f76:6d98]
i dont have much knowledge of network, hopefully someone can help :frowning:
my android app (and ios app) is not working so far

I got the “Unable to connect to Home Assistant” on my Fire tablet and Samsung phone. I added the integration “local_ip” with the numerical ip address and then to access home assistant using the android app replace “homeassistant” with the numerical ip address. http://xxx.xxx.x.xx:8123 . It connects as it is supposed to.

2 Likes

interesting first I have heard of this resolution, do you happen to have the traceback for that error message? Might be worth adding a troubleshooting step in the docs.

I seem to have issues as well. First the versions and setup:
Home Assistant 2021.12.8 in Supervised version, authorization methods are default to homeassistant
Phone: Moto X4, with latest android for this device Android 9
Google Chrome is on the latest version 96.0.4664.104 and the WebView is configured to use Chrome, not the system wide one. I did not customize it, its default.

My connection to the home assistant work from browser internally on IP:8123 as well as externally via the domain name and free DNS on port 80.

The Android app can connect easily on the internal network and port. The problem starts when I get off WiFi and it wants to use the public domain. For some reason it wanted to connect to internal address first and threw the error Web page not available http://<local_ip>:8123 net: ERR_ADDRESS_UNREACHABLE
Ok so I closed the app cleared the cache. Wen opened the app, it no longer launched its window. Instead it went straight to the Google Chrome browser! and url. But even in browser it showed the “Unable to connect to Home Assistant with RETRY button.” I was like, what the heck ? I just verified that it works in browser. And then I saw the problem why app nor browser could connect.

It was trying to connect to https://<correct_public_domain>/lovelace?exteral_auth=1
This is wrong address and HA responds on with page of logo and RETRY option. But no redirect is happening. If I removed the parameters (just delete the /external_auth=1) and just refreshed that browser with main domain, it redirected to /auth/authorize?response_type=.... I tested that broken URL even on my desktop browser and sure enough that is never allowing access.

So for some reason, the app tries the URL that home assistant does not redirect properly and it gets stuck. I managed to get rid of the issue of opening the Google browser only by removing the app data, because something was caching it internally. That’s kind of poor user experience. So now I have working app again on internal network, but it can never resolve the login screen on external URL on my phone :frowning: Maybe if it was trying to reach correct url, it would work like browser demonstrated. Browser works from any device and any network. It actually responds with 200 HTTP response, it may be that the websocket JS library issue or something, but responding 200 and saying it cannot connect is little bit an antipatern.

Every time it breaks on the external URL, the app stops working on internal as well and it redirects to external only via opening the Google Chrome window. So reset, remove data, register user again and it works on internal again. I must be careful not to open app outside of house. Also I cannot install it on my family phones cause there is no point.

The app never works outside of local. This has never resolved. App is useless outside of house … including its location as sensors cannot update. Where can I open the github issue for the app ?

1 Like

I have exactly the same issue, with a Poco F3 and Android 11. Internally all fine, but externally no luck. It indeed keeps on requesting the internal IP outside the local Wifi, even though I have my external address configured. Never had this issue before, did something change?

Edit: I’ve created an issue: Cannot connect externally via app · Issue #2121 · home-assistant/android · GitHub

This is correct per mobile app integration for authenticated webview

Your issue of opening google chrome is strange. what is your network setup like, are you using a proxy? You cant compare to a browser because a browser does not use authenticated webview nor does it make REST API calls or any other communication method that HA accepts. A lot of people are using internal and external URL properly. Try these network troubleshooting tips: Companion App Networking | Home Assistant Companion Docs

sorry we cannot solve failed to connect errors that lead to your own domain. Try to follow some of the outlined troubleshooting steps in the docs. There are network troubleshooting steps and also generic steps on another page.

Hi, thanks for the links, yes the services is behind reverse proxy configured the http2, HSTS and upgraded connection to pass WSS. seems to be all matching the docs when I checked

I looked at the logs from home assistant even at the core container level and there was nothing in there. So I checked the nginx logs and sure enough, home assistant is refusing websocket connection from the app:
2022/01/06 01:54:45 [error] 316#316: *91 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.1, server: <my_public_domain>, request: "GET /api/websocket HTTP/1.1", upstream: "http://192.168.0.18:8123/api/websocket", host: "<my_public_domain>"

The biggest issue is, I have no way to debug what headers or other metadata is the app sending, nor can’t tell why HA is refusing the connection, as HA did not log anything. not even an info. Is there other way to find some deeper debug logs ? Supervisor nor core container has any mention of connection even attempting…

As for the behavior that Google Chrome opens instead of the app, I cannot provide more details, because the logs are only accessible within the app itself, and if I can’t get to menu, then can’t see them. Developers may thing about providing some sort of access to logs without needing even to see the HA Companion app menu in future.

bypass everything here and do a straight connection…if it works then you know you have some configuration changes to make. What changes they are depends on your setup, only you can answer that.

try ADB logcat, which is standard android logging: أداة سطر أوامر Logcat  |  Android Studio  |  Android Developers

have you tried starting fresh? Troubleshooting | Home Assistant Companion Docs

That is what ADB logcat is for, otherwise apps only have access to things they post which is only allowed in their own app. Other logcat apps require special permissions to gain access to everything. Apps can only access their own data by default