Android Widget not updating on mobile network

When I am connected to my home wifi: the widgets get updated.
When I am unsing mobile data and wireguard to my home: the widgets get updated.
When I am using mobile data but wireguard is off (conecting thought the open port on my home router): widget stops updating, but home assistant app works fine.

My guess it is a firewall/route config, because it works fine on wireguard, but I need help to debug.

These are the errors I’ve found on Companion app log, I am not sure if all of them are related to the problem:

11-12 08:27:46.762 29849  9093 E SensorReceiver: Error while getting core config to sync sensor status
11-12 08:27:46.762 29849  9093 E SensorReceiver: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.io.InterruptedIOException: timeout
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.getConfig(IntegrationRepositoryImpl.kt:533)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl$getConfig$1.invokeSuspend(Unknown Source:14)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
11-12 08:27:46.762 29849  9093 E SensorReceiver: Caused by: java.io.InterruptedIOException: timeout
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.timeoutExit(RealCall.kt:398)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.callDone(RealCall.kt:360)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.noMoreExchanges$okhttp(RealCall.kt:325)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:209)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at java.lang.Thread.run(Thread.java:1012)
11-12 08:27:46.762 29849  9093 E SensorReceiver: Caused by: java.io.IOException: Canceled
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:72)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:27:46.762 29849  9093 E SensorReceiver: 	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
11-12 08:27:38.243 29849 29849 E StaticWidget: Unable to fetch entity
11-12 08:27:38.243 29849 29849 E StaticWidget: java.io.InterruptedIOException: timeout
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.connection.RealCall.timeoutExit(RealCall.kt:398)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.connection.RealCall.callDone(RealCall.kt:360)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.connection.RealCall.noMoreExchanges$okhttp(RealCall.kt:325)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:209)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at java.lang.Thread.run(Thread.java:1012)
11-12 08:27:38.243 29849 29849 E StaticWidget: Caused by: java.io.IOException: Canceled
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:72)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
11-12 08:27:38.243 29849 29849 E StaticWidget: 	... 4 more
11-12 08:27:38.245 29849 29849 I AppWidgetManager: updateAppWidget() appWidgetIds = [13]
11-12 08:27:17.832 29849  9092 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
11-12 08:27:17.835 29849  9092 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
11-12 08:27:17.839 29849  9092 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
11-12 08:27:17.842 29849  9092 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
11-12 08:27:17.842 29849  9092 D WebSocketRepository: Sending message 180: {type=ping, id=180}
11-12 08:27:17.843 29849  9092 D WebSocketRepository: Message number 180 sent
11-12 08:27:17.871 29849 30102 E WebSocketRepository: Websocket: onFailure
11-12 08:27:17.871 29849 30102 E WebSocketRepository: java.io.EOFException
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okio.RealBufferedSource.require(RealBufferedSource.kt:202)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okio.RealBufferedSource.readByte(RealBufferedSource.kt:212)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
11-12 08:27:17.871 29849 30102 E WebSocketRepository: 	at java.lang.Thread.run(Thread.java:1012)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: Exception while sending message
11-12 08:27:17.873 29849  9092 E WebSocketRepository: java.io.IOException
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl$handleClosingSocket$1.invokeSuspend(WebSocketRepositoryImpl.kt:809)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
11-12 08:27:17.873 29849  9092 E WebSocketRepository: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

the calls are timing out from the server, so they seem to be unreachable. Check your VPN config maybe?

The problem happens when the VPN is turned off. When it’s on, the widgets update fine.

So the server is not replying to the app calls. Can you help me narrow down the problem?

When not connected to the VPN:

If I open the app, I can see all entities states, I can turn on/off lights, everything goes fine, so my phone is able to reach the server. Why can’t it update the widgets? whats the difference in the connection to the server when I open the app versus when I touch to update the widget?

the frontend does not use API, so the API calls are all failing. You need to ensure the entire URL can be accessible including any and all API paths like REST, websockets etc…

1 Like

I’ve solved the problem. It was the NAT.

I was NATing port 8443 to port 443 and for some reason the APIs don’t work when doing that. Now I’m NATing 8443 to 8443 and it’s working fine.

dshokouhi do you think it’s a bug or is it suposed to work like that?