Hi, I have a Nabu Casa subscription for HA remote access, which works fine in my phone browser. But the HA app and associated widgets no longer work when I’m not on my local network?
Is this expected, or is there some configuration setting in the app that allows it to switch to the Nabu Casa URL when away from the local network?
No idea how - I don’t remember entering my long unique Nabu Casa URL in the app. I guess it must figure it out somehow.
Edit: I spoke too soon. The app itself works remotely, but any widgets don’t. Instead I get some kind of red logo on each status widget showing a failure to update.
I also have the same issue re: Android Widgets - I recently signed up for Nabu Casa and got the android app itself to work when i’m on my mobile network, but Widgets to do not.
i.e. I recently added the Ring integration as I have a Ring Intercom that can unlock the front door to my building.
On a normal HA Dashboard, I have an unlock widget that will operate the door whether I’m at home on wifi or downstairs on a mobile network
I also have a Widget set to call the lock.unlock service. If I’m in my apartment on the local WiFi, this widget works as expected. However, if I’m outside on a mobile network, the Widget times out and fails to do anything.
Hi, sorry about the delay - I didn’t get a notification about your reply to the thread.
Here’s the relevant logs from my app while on my mobile network. It looks like it’s still trying to use the IP address to connect to my server, which of course times out since I’m not able to connect to my local network while outside the apartment.
01-20 09:50:14.921 15751 15751 D ButtonWidget: Broadcast received:
01-20 09:50:14.921 15751 15751 D ButtonWidget: Broadcast action: io.homeassistant.companion.android.widgets.button.ButtonWidget.CALL_SERVICE
01-20 09:50:14.921 15751 15751 D ButtonWidget: AppWidgetId: 10
01-20 09:50:14.923 15751 15751 D ButtonWidget: Calling widget service
01-20 09:50:14.930 15751 15751 D ButtonWidget: Service Call Data loaded:
01-20 09:50:14.930 15751 15751 D ButtonWidget: domain: lock
01-20 09:50:14.930 15751 15751 D ButtonWidget: service: unlock
01-20 09:50:14.930 15751 15751 D ButtonWidget: service_data: {"entity_id":["lock.front_entrance_lock"]}
01-20 09:50:14.942 15751 15751 D ButtonWidget: Sending service call to Home Assistant
01-20 09:50:14.945 15751 15751 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: false
01-20 09:50:14.988 15751 30640 D TrafficStats: tagSocket(119) with statsTag=0xffffffff, statsUid=-1
01-20 09:50:25.029 15751 15751 E ButtonWidget: Could not send service call.
01-20 09:50:25.029 15751 15751 E ButtonWidget: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.net.SocketTimeoutException: failed to connect to /192.168.0.3 (port 8123) from /100.87.91.254 (port 55348) after 10000ms
01-20 09:50:25.029 15751 15751 E ButtonWidget: at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.callService(IntegrationRepositoryImpl.kt:307)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl$callService$1.invokeSuspend(Unknown Source:15)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at android.os.Handler.handleCallback(Handler.java:958)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at android.os.Looper.loopOnce(Looper.java:205)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at android.os.Looper.loop(Looper.java:294)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at android.app.ActivityThread.main(ActivityThread.java:8248)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.lang.reflect.Method.invoke(Native Method)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
01-20 09:50:25.029 15751 15751 E ButtonWidget: Caused by: java.net.SocketTimeoutException: failed to connect to /192.168.0.3 (port 8123) from /100.87.91.254 (port 55348) after 10000ms
01-20 09:50:25.029 15751 15751 E ButtonWidget: at libcore.io.IoBridge.connectErrno(IoBridge.java:235)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at libcore.io.IoBridge.connect(IoBridge.java:179)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.net.Socket.connect(Socket.java:646)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
01-20 09:50:25.029 15751 15751 E ButtonWidget: at java.lang.Thread.run(Thread.java:1012)
thats your issue, looks like it is trying internal IP still. Check the URLs you entered in the app.
Settings > companion app > Select your server and then confirm the URLs. If you have the “use cloud” option checked then uncheck it and see what was saved originally.
So I have the app set up to use the Home Assistant Cloud. If I disable that, the URL is set to my HA server’s internal IP/port (the 192.168.0.3:8123 from my previous logs). Regardless of that setting, I’m unable to configure the Internal URL
I tried the button again while on my WiFi network, and the only difference in the logs (up until the failure) is that the usesWiFi flag is true, which I’d expect:
01-22 12:00:09.675 21258 21258 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
I also made sure that background access was enabled just to make sure that wasn’t causing an issue, but the unlock widget on my android home screen still fails, while using a native HA dashboard widget from within the android app works as expected.
Why would the ButtonWidget attempt to contact my server via the internal IP address when the usesWifi flag is false, and Home Assistant Cloud is enabled?
OK, so is the fact that the “Use Home Assistant Cloud” setting doesn’t seem to work as expected a bug?
I just re-checked the settings - made sure the HA app had location access at all times, added my Home Network WiFi SSID, and only then did the Internal Connection URL field become enabled - which I then configured to http://homeassistant.local:8123
I left the Home Assistant URL set to Use Home Assistant Cloud and just as before, with WiFi disconnected and on my mobile network, the HA App functioned normally, including access to dashboards and control of devices like this lock. However the native Android widget still timed out.
Based on your comment, I then tried disabling Home Assistant Cloud toggle and manually entering the URL provided in the Home Assistant Cloud settings section. That finally allowed the native Android widget to function.
(@woodentop do you want to see if you’re also able to get your widget working?)
So now: Why does the “Use Home Assistant Cloud” toggle correctly allow the HA App to function, but fails to allow android widgets to work? I thought half the point of Nabu Casa was the ease of configuration - not having to disable the cloud settings and manually pastie in a URL that’s already accessible to HA on a different settings page. Am I missing something?
yes and I believe its been corrected in recent HA core versions
yes that is correct you need to define your internal network before you define the URL to use when you are local
thats because the app expects to retrieve proper URLs from the server automatically but sometimes it fails and we dont get correct data. A more recent HA version was supposed to correct that and also logging out and logging back in should also request recent URLs.
Can you check the URLs defined in Settings > System > Network do those look correct?
OK, I think I was still on a November or December Core… just updated, reverted the Home Assistant URL to my local server address, then toggled the Use Home Assistant Cloud back on. It seems like my android widget is still working correctly now - so that could have been the issue all along.
Thanks for pointing me in the right direction regarding the URL settings, and glad the issue I encountered seems to be resolved.
(and the Settings > System > Network page appears to be set up correctly)