Mobile app can't connect - ARGH!

some time ago i configured the duckdns integration, and since then i can not use the mobile app to connect to my home assistant.

has anyone found a solution to this problem?

its impossible to tell what your issue is by just this description, best to go by the companion app logs to see waht the error is so you can figure out what to fix.

Where do I find those logs?

Settings > Companion App > Show and share logs

Also, there would at least be a symptom more descriptive than “can’t connect”. Are there any error messages? Is it just spinning? Did you follow a proper DuckDNS guide to set things up? Given the quality of your post I would suggest you just pay the $6.50 for Nabu Casa and you’re done.

you mean in home assistant itself or in the app? well, i checked home assistant, and i couldn’t find companion app under settings. and i can’t check the app because it can’t connect :frowning:

do you get a “cannot connect popup”

when i launch the app on my phone, i get that start screen. i tap continue, and the next screen tells me to “select the instance you would like to connect to” with a lot of white below the text. and at the bottom it says “enter address manually”. i tap that and enter my duckdns url, then press enter, and at the bottom it says “unable to connect to home assistant”. no explanation, no settings icon, no nothing.

Can you connect to your HA instance via that DuckDNS address from your browser?

absolutely. i can connect to my home assistant from my PC, from my tablet and until last week i could also connect from my phone, but that’s another story. but the browser doesn’t have the same functionality, like battery level, wifi signal strength or location. thats why i want to use the app instead of a browser.

I didn’t say you should, but we need to debug this somehow.

What happens if you use your phone’s browser?

it used to work the same as on my tablet or my computer, but sometime last week it started giving me errors saying that the connection has been reset. this ONLY happens on the phone, and it happens EVERY time. over the internet or on my wifi, i get the same “connection reset” error. i just don’t understand why it is doing that. i have not changed any configuration. WEIRD.

You didn’t answer this.

Give the exact error message you are getting.

Did you upgrade your phone’s software? Did the companion app update? Which version of the app and mobile OS are you running? Could you try to reinstall the app?

Since I’m facing the same problem, I thought I may add some more info here that might help both of us.

Companion app version is 2022.11.0, updated yesterday and android version 8.1. When connected to home network and try to connect to HA, I’m receiving a popup saying unable to connect and giving three options. Also, none of the widgets are working (I have 3 button widgets and entity state widgets).

If I press “refresh external URL”, I can connect to HA, but the widgets cannot update their status or perform their actions.

If I turn off my phone’s Wi-Fi and have only my data on, I can connect to HA without the popup and widgets are working again all fine.

The connection settings in the companion app are shown in the next screenshot. If I reverse the addresses (put the local one in the “HA URL” field and the remote one in “Internal URL” field), there is no problem when I’m connected to my home network, but when I’m outside I’m greeted with the same “unable” popup, but with the second option being for refreshing the internal URL instead of the external. And the widgets don’t work again.

Edit:
Terribly sorry, forgot to share the log. This is where I believe to be the problem, but if you want, I can upload the entire log:

11-25 12:12:45.995 23954 24170 E SensorReceiver: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.net.SocketTimeoutException: failed to connect to /192.168.0.202 (port 8123) from /some_external_IP (port XXXXX) after 10000ms
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.updateSensors(IntegrationRepositoryImpl.kt:727)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl$updateSensors$1.invokeSuspend(Unknown Source:15)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
11-25 12:12:45.995 23954 24170 E SensorReceiver: Caused by: java.net.SocketTimeoutException: failed to connect to /192.168.0.202 (port 8123) from /some_external_IP (port XXXXX) after 10000ms
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at libcore.io.IoBridge.connectErrno(IoBridge.java:185)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at libcore.io.IoBridge.connect(IoBridge.java:130)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:357)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.net.Socket.connect(Socket.java:616)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.kt:63)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
11-25 12:12:45.995 23954 24170 E SensorReceiver: 	at java.lang.Thread.run(Thread.java:764)
11-25 12:12:47.562 23954 23954 W ResourceType: No package identifier when getting name for resource number 0x00000000