Cannot connect to HA via companion app when away from homoe

I am running HA supervised on Rpi4b and it has been regularly updated to the latest updates.

I connect to HA via various devices, and it includes the companion app on android phones.

The issue I have been facing for quite some time is that if I am at home and connected to home wifi, then the companion app is able to connect to the HA instance without any issues.

Once I switch off my wifi on phone, or am away from home and using mobile data, the companion app is able to connect to HA instance (I guess via Nabu Casa). But after some minutes it cannot connect to HA instance. I can still connect to HA instalce via nabu casa using chrome or firefox browser - but not via companion app.

I have gone through lots of lots of posts which are aboue the same issue and still have not been able to find a solution/fix for the issue.

For the technical part, here is what the HA logger shows when I try and connect via the companion app while using data (not wifi):

2023-09-13 16:53:52.800 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from localhost (127.0.0.1). Requested URL: ‘/auth/token’. (Home Assistant/2023.9.2-11226 (Android 13; PGT-N19))

2023-09-13 16:53:53.016 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from localhost (127.0.0.1). Requested URL: ‘/auth/token’. (Home Assistant/2023.9.2-11226 (Android 13; PGT-N19))

2023-09-13 16:53:53.130 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from localhost (127.0.0.1). Requested URL: ‘/api/websocket’. (Mozilla/5.0 (Linux; Android 13; PGT-N19 Build/HONORPGT-N49; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.0.0 Mobile Safari/537.36 Home Assistant/2023.9.2-11226 (Android 13; PGT-N19))

2023-09-13 16:53:53.334 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from localhost (127.0.0.1). Requested URL: ‘/auth/token’. (Home Assistant/2023.9.2-11226 (Android 13; PGT-N19))

2023-09-13 16:54:12.782 WARNING (MainThread) [homeassistant.components.websocket_api.http.connection] [2374270568] from 127.0.0.1 (Home Assistant/2023.9.2-11226 (Android 13; PGT-N19)): Disconnected: Did not receive auth message within 10 seconds

Fyi, I am not using any form of reverse proxy or NGINX. My home network is based on Unifi UDM Pro and HA instance has a fixed ip address. I read some posts about google webview on the android phone, but I believe that is already up-to-date.

I am facing this issue on two phone which are Samsung Galaxy S23 Ultra & Honor Magic 5 Pro.

Some key lines from configuration.yaml:

homeassistant:
customize: !include customize.yaml
auth_providers:
- type: trusted_networks
trusted_networks:
- 192.168.1.0/24
- 192.168.50.0/24
- 127.0.0.1*
- type: homeassistant

http:
ip_ban_enabled: false
use_x_forwarded_for: true
trusted_proxies: 127.0.0.1

The lines from the log file on my phone (Honor Magic 5 Pro) are as below (I have scanned through this and could not find any sensitive info, but if you see anything that I should not post kindly let me know and I will remove it).

--------- beginning of system
09-13 16:39:17.184 9404 9404 D ActivityThread: Won’t deliver top position change in state=5
*09-13 16:39:17.188 9404 9404 I ActivityThread: Performing restart of ActivityRecord{33df60e token=android.os.BinderProxy@8e69409 {io.homeassistant.companion.android/io.homeassistant.companion.android.webview.WebViewActivity}} start=false callers:android.app.servertransaction.TransactionExecutor.performLifecycleSequence:258 android.app.servertransaction.TransactionExecutor.cycleToPath:215 android.app.servertransaction.TransactionExecutor.executeLifecycleState:187 android.app.servertransaction.TransactionExecutor.execute:105 android.app.ActivityThread$H.handleMessage:2834 android.os.Handler.dispatchMessage:114 android.os.Looper.loopOnce:206 android.os.Looper.loop:296 android.app.ActivityThread.main:9155 java.lang.reflect.Method.invoke:-2 *
09-13 16:39:17.407 9404 9404 D RtgSched: resetRtgSchedHandle failed enable:1
09-13 16:39:18.010 9404 9404 I HwForceDarkManager: setAllowedHwForceDark:false package:io.homeassistant.companion.android mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
09-13 16:39:20.745 9404 9404 I VRI[WebViewActivity]: dispatchDetachedFromWindow in doDie
09-13 16:39:22.038 9404 9404 W LoadedApk: Finishing null broadcast to WV.ue@bff8251, mForgotten:true
09-13 16:39:22.339 9404 9404 I HwForceDarkManager: setAllowedHwForceDark:false package:io.homeassistant.companion.android mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
09-13 16:39:23.305 9404 9404 I VRI[WebViewActivity]: dispatchDetachedFromWindow in doDie
09-13 16:39:23.926 9404 9404 W LoadedApk: Finishing null broadcast to WV.ue@bff8251, mForgotten:true
09-13 16:39:24.226 9404 9404 I HwForceDarkManager: setAllowedHwForceDark:false package:io.homeassistant.companion.android mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
09-13 16:39:24.807 9404 9404 I VRI[WebViewActivity]: dispatchDetachedFromWindow in doDie
09-13 16:39:25.417 9404 9404 W LoadedApk: Finishing null broadcast to WV.ue@bff8251, mForgotten:true
09-13 16:39:25.720 9404 9404 I HwForceDarkManager: setAllowedHwForceDark:false package:io.homeassistant.companion.android mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
--------- beginning of main
09-13 16:39:25.916 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:39:25.916 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:11.263 9404 9404 I VRI[WebViewActivity]: dispatchDetachedFromWindow in doDie
09-13 16:40:11.265 9404 9531 I BufferQueueProducer: VRI[WebViewActivity]#10(BLAST Consumer)10 disconnect: api 1
09-13 16:40:11.265 9404 9531 D OpenGLRenderer: endAllActiveAnimators on 0xb40000797c945090 (RippleDrawable) with handle 0xb4000078aa9707f0
09-13 16:40:11.265 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8d2fc0 count: 9
09-13 16:40:11.280 9404 10392 I SurfaceControl: SurfaceControl 0xb4000078fe8bbd30
09-13 16:40:11.281 9404 10392 I SurfaceControl: SurfaceControl 0xb4000078fe8b1410
09-13 16:40:11.281 9404 10392 I SurfaceControl: SurfaceControl 0xb4000078fe8e2cc0
09-13 16:40:11.282 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe902cf0 count: 2
09-13 16:40:11.282 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe902cf0
09-13 16:40:11.282 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8abab0 count: 2
09-13 16:40:11.283 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8abab0
09-13 16:40:11.283 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8f9d40 count: 2
09-13 16:40:11.283 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8f9d40
09-13 16:40:11.303 9404 10392 I BufferQueueConsumer: VRI[WebViewActivity]#10(BLAST Consumer)10 disconnect
09-13 16:40:11.304 9404 10392 I SurfaceControl: ~SurfaceControl 0xb4000078fe8d2fc0
09-13 16:40:11.318 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:11.319 9404 9404 D IntegrationRepository: isAppLocked(): false. (LockEnabled: false, appActive: false, expireMillis: 0, currentMillis: 1694619611319)
09-13 16:40:11.319 9404 9404 D DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
09-13 16:40:11.321 9404 9404 W InputMethodManager: startInputReason = 1
09-13 16:40:11.325 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:11.325 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:11.327 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:11.327 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:12.347 9404 9404 D WebviewActivity: No unique cases found to override
09-13 16:40:12.405 9404 9404 W LoadedApk: Finishing null broadcast to WV.ue@bff8251, mForgotten:true
09-13 16:40:12.507 9404 9811 D WebviewActivity: External bus {“type”:“config/get”,“id”:1}
09-13 16:40:12.508 9404 9404 D WebviewActivity: externalBus({“id”:1,“type”:“result”,“success”:true,“result”:{“hasSettingsScreen”:true,“canWriteTag”:true,“hasExoPlayer”:true,“canCommissionMatter”:true,“hasAssist”:true}});
09-13 16:40:12.522 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.522 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:12.525 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.525 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:12.526 9404 9404 D WebviewActivity: Callback null
09-13 16:40:12.526 9404 9404 D WebviewActivity: Color from webview is “#101e24-SPACER-#111111
09-13 16:40:12.526 9404 9404 D WebviewActivity: Color from webview is “#101e24-SPACER-#111111
09-13 16:40:12.527 9404 9638 D WebViewPresenterImpl: Try getting color from webview color “#101e24”.
09-13 16:40:12.527 9404 9638 I WebViewPresenterImpl: Found color -15720924.
09-13 16:40:12.528 9404 9638 D WebViewPresenterImpl: Try getting color from webview color “#111111”.
09-13 16:40:12.528 9404 9638 I WebViewPresenterImpl: Found color -15658735.
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: Unable to retrieve external auth
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: io.homeassistant.companion.android.common.data.authentication.AuthorizationException
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.refreshSessionWithToken(AuthenticationRepositoryImpl.kt:175)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.access$refreshSessionWithToken(AuthenticationRepositoryImpl.kt:16)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl$refreshSessionWithToken$1.invokeSuspend(Unknown Source:15)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at android.os.Handler.handleCallback(Handler.java:971)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at android.os.Handler.dispatchMessage(Handler.java:107)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loopOnce(Looper.java:206)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loop(Looper.java:296)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at android.app.ActivityThread.main(ActivityThread.java:9155)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at java.lang.reflect.Method.invoke(Native Method)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
09-13 16:40:12.642 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1018)
09-13 16:40:12.647 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.647 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:12.651 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.653 9404 9404 I DecorView[]: old windowMode:0 new windoMode:1
09-13 16:40:12.673 9404 9404 D InputEventReceiver: dispatchInputInterval 1000000
09-13 16:40:12.677 9404 30781 W HiTouch_HiTouchSensor: depended package hiTouch does n’t exist!
09-13 16:40:12.677 9404 30781 I HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don’t exist.
09-13 16:40:12.677 9404 30781 D HiTouch_PressGestureDetector: onAttached, package=io.homeassistant.companion.android, windowType=2, mHiTouchRestricted=true
09-13 16:40:12.678 9404 9470 I SurfaceControl: SurfaceControl 0xb4000078fe8cf4a0
09-13 16:40:12.678 9404 10392 I SurfaceControl: SurfaceControl 0xb4000078fe8d99a0
09-13 16:40:12.678 9404 10392 I SurfaceControl: SurfaceControl 0xb4000078fe8bf640
09-13 16:40:12.682 9404 9404 I SurfaceControl: SurfaceControl 0xb4000078fe8b0910
09-13 16:40:12.682 9404 9404 I SurfaceControl: SurfaceControl 0xb4000078fe8e11f0
09-13 16:40:12.682 9404 9404 I SurfaceControl: SurfaceControl 0xb4000078fe8b1150
09-13 16:40:12.682 9404 9404 I BufferQueueConsumer: connect: controlledByApp=false
09-13 16:40:12.684 9404 9531 I BufferQueueProducer: VRI[WebViewActivity]#11(BLAST Consumer)11 connect: api=1 producerControlledByApp=true
09-13 16:40:12.684 9404 9531 E OpenGLRenderer: Unable to match the desired swap behavior.
09-13 16:40:12.684 9404 9404 I HwForceDarkManager: setAllowedHwForceDark:false package:io.homeassistant.companion.android mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
09-13 16:40:12.689 9404 9531 W Parcel : Expecting binder but got null!
09-13 16:40:12.701 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8bbd30 count: 2
09-13 16:40:12.701 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8bbd30
09-13 16:40:12.701 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8e2cc0 count: 2
09-13 16:40:12.701 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8e2cc0
09-13 16:40:12.701 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8b1410 count: 2
09-13 16:40:12.701 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8b1410
09-13 16:40:12.701 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8b1150 count: 2
09-13 16:40:12.701 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8b1150
09-13 16:40:12.701 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8e11f0 count: 2
09-13 16:40:12.701 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8e11f0
09-13 16:40:12.701 9404 9404 D DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
09-13 16:40:12.792 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.792 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:12.797 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.797 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: Unable to retrieve external auth
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: io.homeassistant.companion.android.common.data.authentication.AuthorizationException
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.refreshSessionWithToken(AuthenticationRepositoryImpl.kt:175)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.access$refreshSessionWithToken(AuthenticationRepositoryImpl.kt:16)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl$refreshSessionWithToken$1.invokeSuspend(Unknown Source:15)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at android.os.Handler.handleCallback(Handler.java:971)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at android.os.Handler.dispatchMessage(Handler.java:107)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loopOnce(Looper.java:206)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loop(Looper.java:296)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at android.app.ActivityThread.main(ActivityThread.java:9155)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at java.lang.reflect.Method.invoke(Native Method)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
09-13 16:40:12.893 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1018)
09-13 16:40:12.903 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:12.903 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:15.189 9404 9404 D ServerConnectionInfo: Using internal URL
09-13 16:40:15.196 9404 9404 I VRI[WebViewActivity]: dispatchDetachedFromWindow in doDie
09-13 16:40:15.197 9404 9531 I BufferQueueProducer: VRI[WebViewActivity]#11(BLAST Consumer)11 disconnect: api 1
09-13 16:40:15.197 9404 9531 D OpenGLRenderer: endAllActiveAnimators on 0xb40000797c951820 (RippleDrawable) with handle 0xb4000078aa989270
09-13 16:40:15.197 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8b0910 count: 6
09-13 16:40:15.209 9404 9470 I SurfaceControl: SurfaceControl 0xb4000078fe8d5e80
09-13 16:40:15.209 9404 9470 I SurfaceControl: SurfaceControl 0xb4000078fe8b1150
09-13 16:40:15.209 9404 9470 I SurfaceControl: SurfaceControl 0xb4000078fe8cf600
09-13 16:40:15.210 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8bf640 count: 2
09-13 16:40:15.210 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8bf640
09-13 16:40:15.210 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8d99a0 count: 2
09-13 16:40:15.210 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8d99a0
09-13 16:40:15.211 9404 9470 I BufferQueueConsumer: VRI[WebViewActivity]#11(BLAST Consumer)11 disconnect
09-13 16:40:15.211 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8cf4a0 count: 2
09-13 16:40:15.211 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8cf4a0
09-13 16:40:15.211 9404 9470 I SurfaceControl: ~SurfaceControl 0xb4000078fe8b0910
09-13 16:40:15.243 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:15.243 9404 9404 D IntegrationRepository: isAppLocked(): false. (LockEnabled: false, appActive: false, expireMillis: 0, currentMillis: 1694619615243)
09-13 16:40:15.244 9404 9404 D DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
09-13 16:40:15.244 9404 9404 W InputMethodManager: startInputReason = 1
09-13 16:40:15.250 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:15.250 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:15.253 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:15.253 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:16.473 9404 9404 D Choreographer: still have 8 traversal callbacks
09-13 16:40:16.607 9404 9404 D WebviewActivity: No unique cases found to override
09-13 16:40:16.623 9404 9404 W LoadedApk: Finishing null broadcast to WV.ue@bff8251, mForgotten:true
09-13 16:40:16.685 9404 9811 D WebviewActivity: External bus {“type”:“config/get”,“id”:1}
09-13 16:40:16.685 9404 9404 D WebviewActivity: externalBus({“id”:1,“type”:“result”,“success”:true,“result”:{“hasSettingsScreen”:true,“canWriteTag”:true,“hasExoPlayer”:true,“canCommissionMatter”:true,“hasAssist”:true}});
09-13 16:40:16.773 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:16.773 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:16.777 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:16.777 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:16.781 9404 9404 D WebviewActivity: Callback null
09-13 16:40:16.782 9404 9404 D WebviewActivity: Color from webview is “#101e24-SPACER-#111111
09-13 16:40:16.782 9404 9404 D WebviewActivity: Color from webview is “#101e24-SPACER-#111111
09-13 16:40:16.782 9404 9638 D WebViewPresenterImpl: Try getting color from webview color “#101e24”.
09-13 16:40:16.782 9404 9638 I WebViewPresenterImpl: Found color -15720924.
09-13 16:40:16.782 9404 9499 D WebViewPresenterImpl: Try getting color from webview color “#111111”.
09-13 16:40:16.782 9404 9499 I WebViewPresenterImpl: Found color -15658735.
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: Unable to retrieve external auth
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: io.homeassistant.companion.android.common.data.authentication.AuthorizationException
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.refreshSessionWithToken(AuthenticationRepositoryImpl.kt:175)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.access$refreshSessionWithToken(AuthenticationRepositoryImpl.kt:16)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl$refreshSessionWithToken$1.invokeSuspend(Unknown Source:15)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at android.os.Handler.handleCallback(Handler.java:971)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at android.os.Handler.dispatchMessage(Handler.java:107)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loopOnce(Looper.java:206)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loop(Looper.java:296)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at android.app.ActivityThread.main(ActivityThread.java:9155)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at java.lang.reflect.Method.invoke(Native Method)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
09-13 16:40:16.893 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1018)
09-13 16:40:16.902 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:16.902 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:16.914 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:16.919 9404 9404 I DecorView[]: old windowMode:0 new windoMode:1
09-13 16:40:16.945 9404 9404 D InputEventReceiver: dispatchInputInterval 1000000
09-13 16:40:16.949 9404 30818 W HiTouch_HiTouchSensor: depended package hiTouch does n’t exist!
09-13 16:40:16.949 9404 30818 I HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don’t exist.
09-13 16:40:16.949 9404 30818 D HiTouch_PressGestureDetector: onAttached, package=io.homeassistant.companion.android, windowType=2, mHiTouchRestricted=true
09-13 16:40:16.954 9404 9470 I SurfaceControl: SurfaceControl 0xb4000078fe8cf3f0
09-13 16:40:16.954 9404 9470 I SurfaceControl: SurfaceControl 0xb4000078fe8b1620
09-13 16:40:16.954 9404 10392 I SurfaceControl: SurfaceControl 0xb4000078fe8dea10
09-13 16:40:16.954 9404 9404 I SurfaceControl: SurfaceControl 0xb4000078fe8f8c10
09-13 16:40:16.954 9404 9404 I SurfaceControl: SurfaceControl 0xb4000078fe8dce90
09-13 16:40:16.954 9404 9404 I SurfaceControl: SurfaceControl 0xb4000078fe8f3af0
09-13 16:40:16.955 9404 9404 I BufferQueueConsumer: connect: controlledByApp=false
09-13 16:40:16.957 9404 9531 I BufferQueueProducer: VRI[WebViewActivity]#12(BLAST Consumer)12 connect: api=1 producerControlledByApp=true
09-13 16:40:16.957 9404 9531 E OpenGLRenderer: Unable to match the desired swap behavior.
09-13 16:40:16.957 9404 9404 I HwForceDarkManager: setAllowedHwForceDark:false package:io.homeassistant.companion.android mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
09-13 16:40:16.962 9404 9531 W Parcel : Expecting binder but got null!
09-13 16:40:16.966 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8f3af0 count: 2
09-13 16:40:16.966 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8f3af0
09-13 16:40:16.966 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8dce90 count: 2
09-13 16:40:16.966 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8dce90
09-13 16:40:16.966 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8d5e80 count: 2
09-13 16:40:16.966 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8d5e80
09-13 16:40:16.966 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8cf600 count: 2
09-13 16:40:16.966 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8cf600
09-13 16:40:16.966 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8b1150 count: 2
09-13 16:40:16.966 9404 9404 I SurfaceControl: ~SurfaceControl 0xb4000078fe8b1150
09-13 16:40:16.979 9404 9404 D DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
09-13 16:40:17.028 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:17.028 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:17.032 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:17.032 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:17.087 9404 9531 I pwIrisCR: YYY2-2 CoreContext[0xb4000079608b0b70]:: Destruct: ##PID##:9404
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: Unable to retrieve external auth
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: io.homeassistant.companion.android.common.data.authentication.AuthorizationException
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.refreshSessionWithToken(AuthenticationRepositoryImpl.kt:175)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl.access$refreshSessionWithToken(AuthenticationRepositoryImpl.kt:16)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at io.homeassistant.companion.android.common.data.authentication.impl.AuthenticationRepositoryImpl$refreshSessionWithToken$1.invokeSuspend(Unknown Source:15)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at android.os.Handler.handleCallback(Handler.java:971)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at android.os.Handler.dispatchMessage(Handler.java:107)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loopOnce(Looper.java:206)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at android.os.Looper.loop(Looper.java:296)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at android.app.ActivityThread.main(ActivityThread.java:9155)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at java.lang.reflect.Method.invoke(Native Method)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
09-13 16:40:17.140 9404 9404 E WebViewPresenterImpl: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1018)
09-13 16:40:17.153 9404 9404 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:17.153 9404 9404 D ServerConnectionInfo: Using cloud / remote UI URL
09-13 16:40:19.374 9404 9404 D LocBroadcastReceiver: Received location update.
09-13 16:40:19.378 9404 9404 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
*09-13 16:40:19.378 9404 9654 D LocBroadcastReceiver: Last Location: *
09-13 16:40:19.378 9404 9654 D LocBroadcastReceiver: Coords:(51.4493895, -0.4390501)
09-13 16:40:19.378 9404 9654 D LocBroadcastReceiver: Accuracy: 13.556
09-13 16:40:19.378 9404 9654 D LocBroadcastReceiver: Bearing: 0.0
09-13 16:40:19.379 9404 9654 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
09-13 16:40:19.379 9404 9654 D LocBroadcastReceiver: Received location that is 790 milliseconds old, 1694619618589 compared to 1694619619379 with source fused
09-13 16:40:19.383 9404 9654 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
09-13 16:40:20.335 9404 9654 D LocBroadcastReceiver: Location update sent successfully for 1 as exact
09-13 16:40:24.075 9404 9404 I VRI[WebViewActivity]: dispatchDetachedFromWindow in doDie
09-13 16:40:24.076 9404 9531 I BufferQueueProducer: VRI[WebViewActivity]#12(BLAST Consumer)12 disconnect: api 1
09-13 16:40:24.078 9404 9531 D OpenGLRenderer: endAllActiveAnimators on 0xb40000797c95a5c0 (RippleDrawable) with handle 0xb4000078aa98bd00
09-13 16:40:24.078 9404 9404 I SurfaceControl: nativeRelease 0xb4000078fe8f8c10 count: 6

I am going to take a wild guess and assume when you logged into the app you used trusted networks. Log out of hte app and log back in and make sure to use your login credentials to get the correct token. Logins authenticated using trusted networks only works on the trusted network.

Actually no. I always log into the app using the option where it asks me to enter my login and password.
But I’ve still logged out and logged in again.

And I went a step further. I cleared the disk space used by HA on my phone so basically removed all the config settings from HA companion app on phone. After this it asked me for my HA url and I gave Nabu Casa url followed by login id and password and successfully logged in.

One thing I noticed and realised just now … not sure if this miight be the cause of the issue I have been facing.

I always used the Nabu Casa url as “https://nnnnnnnnnnnnnnnn.ui.nabu.casa/mohta-home/default_view” (nnnn is just to hide the real url :slight_smile: ) and whenever I would come out of the companion app, it would not remember this url and ask me again to enter the url.

So just to try, I tried the actual url ending with nabu.casa/ and nothing after that (and I realise now that I should always have used this url).

So far this seems to be working and I can now login using mobile data as well as wifi.

I will check again in 20 minutes or so if I again get the connection error or not.

May be this was the issue.

this is caused by not using the base URL but providing a URL to a lovelace path. Unfortunately a known issue and the only way to correct it is to login using the proper URL.