Android app no longer switching to external url

Since updating to 2022.5.x, the one Android phone in my house stopped connecting externally. This has been working fine via Nabu Casa for years. It works from all iPhone devices and browsers internally or externally. It’s only the Android phone that stoped. The android device is running the version from March 2022.

If I look in App settings, there is nothing about an external url there. I’ve tried setting "Use Home Assistant Cloud on the server and setting homeassistant->external_url in configuration.yaml. No matter what I do, everything works fine on iPhone but not the Android. I tried re-installing the Android app. Again, only works internally.

As I said, this was working perfectly until about 9 days ago. Nothing has changed except the server.

2 Likes

I’m facing exactly the same issue. It used to be working just fine until several days ago.

Now I have to open my browser and head to the site of nabu casa, authenticate, go to my profile, open remote ui, authenticate in hassio, go to my dashboard before I can answer my doorbell.

By the time I’m able to answer the doorbell, the person that rang my doorbell celebrated 2 times their birthday.

Also a good thing: I’m now forced to use my VPN.

I am using a Samsung Galaxy S10. I turned off my wifi to force it to access from external. It couldn’t connect, however, there was a page presented that had, I think, 3 options. One was to “Refresh External Link”. I did that and all was fine after that. I’m using HA 2022.5.5 in Docker Container on Synology NAS. Phone HA app is version 2022.3.0-full (seems to be the latest available in Play Store)

I tried the refresh external link several times. Explicitly setting the external link or using the “Use Home Assistant Cloud” option. Still not able to connect.

I have a similar issue, I have an Amazon HD10, I Fire Toolboxed it and am using the latest companion app. I set it up with NabuCasa and internal IP, then it stopped working until I removed the IP, i added https://homeassistant.local:8123/ as per some instructions and that worked for a day then it stopped, I just use NabuCasa now and it loads and works but some items like wallpanel_screensaver does not work, this is only on the companion app through, if I use it in a browser it works locally and with NabuCasa, it is NOW playing up on my companion app on my Android Samsung S21 :frowning:

https is not valid locally so that would neve work with the android app.

For those who have this error, when you get the pop-up with the Wait, Refresh and Settings links go to Settings and then Logs and look at the failure that should help pin point the error.

Also do not enable prioritize internal if you leave location enabled…that feature is meant for users who have location disabled on their devices and are ok with the refreshing they need to do.

what about https with the IP address? that was working and the stopped, that is the only reason I tried https://homeassistant.local:8123/
Until recently my amazon Fire HD10 and phone worked perfectly using Nabu Casa and the internal HTTPS IP address, prioritise internal was never enabled. I only started fiddling since the issue.
My wallpad now uses Fully Kiosk Browser so it works but would prefer to use the app.
I’ll look at the logs again :slight_smile:

I can see the following on my logs
ERROR (MainThread) [frontend.js.latest.202205041] https://xxxxxxxxxxxxxxxx.ui.nabu.casa/lovelace-mobile/home?external_auth=1:0:0 Uncaught
and
ERROR (MainThread) [frontend.js.latest.202205041] https://xxxxxxxxxxxxxxxx.ui.nabu.casa/lovelace-mobile/home:0:0 Uncaught
so my android phone gets this but cannot see anything coming from the fire hd, well the HD doesn’t work at all and the phone does, these errors are in time with when using my phone, if that makes sense

no and it was never working before either, you just never noticed. SSL certificates must be valid with the android app, that has always been true since the app started.

You are looking at HA core logs, you need to look at Companion App Logs. Configuration > Companion App > Logs, or by clicking on Settings on the “can not connect” pop-up

thanks, that makes sense!
Can’t get the logs from the Fire HD, i get

logcat: invalid option
Unrecognised Option

It works when I use Nabu Casa so will stick with that and/or Fully Kiosk Browser, she’ll be right, if the internet goes down then i’ll have bigger issues to deal with :slight_smile:
Thanks for your help, it IS appreciated.

I’m still seeing this issue. If I go to app settings for the HA Android app, I see a web url and an internal url. The problem is that the internal URL is not editable. Only the web url is editable. The problem is that whatever I type into the web url gets copied over to the internal url. This gives me no way to have both.

Anyone know how I can convince the Android app to either:

  1. Allow me to edit both urls
  2. Retrieve the internal and external urls from the server like it used to

Anyone?

You need to first put in the home wifi SSID in order to add the internal url. Otherwise how will the app know to switch to the internal one?

I don’t remember seeing that option. I will check again when I can get my son’s phone. He’s the only one in the house with Android.

I know there isn’t an SSID option on the iPhone. At least not one that I found.

Adding the SSID didn’t change anything. If I turn off Wifi, the Android app waits a minute or so and then asks to refresh the external url. I do that, but it still doesn’t work. All the iPhones (4 of them + 2 iPads) all work perfectly using the external url. It’s only the Android device that no longer seems to work.

This is messing some some automations I have to determine if the house is empty or not. My presence detection depends on knowing the location of the phones.

Regarding requiring the SSID to know when to switch to the external url, that’s not the way the iPhone works. There is no entry for the SSID, but it knows just fine.

Please turn off prioritize internal if you have it enabled, it is really only meant for users who leave location off on their device. Based on the description it sounds like you have it enabled.

If you had prioritize internal enabled you probably need to hit the refresh button once more, if it continues to fail then go to settings from that pop-up and look at the companion app logs to see the cause of the failure.

Android and iOS are completely different in terms of what data is provided to the apps and what they can access so there will be implementation differences as a result. The only way the android app can tell if you are at home is by the user defining the Home WiFi SSIDs. The app will need to have location permission in order to read this as well, without it the app will not be able to tell if you are at home.

The phone does not have prioritize internal on. I’ll check the logs when my son returns.

I understand iOS and Android are different (software developer for 30 years). With the right permissions, an iOS app can get the SSID, but there is no entry in the iOS app to declare which SSID is your home one. I haven’t tried it from a different SSID in a while, but the iPhone might just assume you’re home if you’re on WiFi.

As I said, this worked great for months. It didn’t start failing until the May server updates.No other changes to config on the server or phone happened. My son with the Android phone never even runs HA. HA is only on his phone so my presence detection and location work. Until I can get location to work again, I’m limited to detection of him being on our WiFi or not via the UniFi integration. With location, it was good to know when he left work or school to know when to expect him home.

I feel like there is a chicken and egg issue here. When you’re not connected to the home WiFi, the Android app will ask to refresh the external url. However, how can it do that if it doesn’t have access to the server to get it? I want it to retrieve the external url (Nabu Casa in my case) while it has a connection.

Sorry, still haven’t got the logs. My son has be all over the place the last few days.

the external URL is the first URL you give to the app when you sign in.

if that is not the nabu casa URL then you need to add it in Configuration > Companion App

That’s interesting. One of the big pluses of Nabu Casa is that you never should have to enter the external URL. When you choose to use Nabu Casa, you don’t even provide the external URL anywhere in the configuration. When you connect locally, the app retrieves the Nabu Casa url. However, it seems the Android app doesn’t work that way. The two urls in the config are always the same.

I will repeat again that this worked perfectly for well over a year. It stopped in May after a server update with zero config changes on my part. Every client instance in my house (at least 10 including the Android one) was setup with my internal URL, and the external access just worked. It makes sense since setting up clients with the Nabu Casa url is not that practical. The Nabu Case url is a GUID, not exactly memorable or easy to type. Something in the server changed that broke the way Android works. It no longer automatically switches between internal and external urls when using Nabu Casa.

Note, I also tried manually setting the internal and external urls on the server (not using the Nabu Casa option). Again, all the iOS clients worked, but the Android one still will not switch between internal and external. I also deleted the Android app and re-installed, but that changed nothing. It looked like Android kept the old config even though I deleted the app because it did not ask me for the url again.

When you setup the android app if the HA server did not send external URL during discovery then the app will stick with whatever was given. All you have to do is update the URL in the location I mentioned. Its a one time thing.

It does still continue to work, you just need to do some troubleshooting and put in the correct URLs and configuration. Adding URLs is a one time thing. You should be able to copy and paste the URL as well so no need to remember or type it out.

This doesn’t sound like the location I mentioned to check.

sounds like you may need to start fresh to make sure the app does not restore the previously backed up bad config. Re-installing the app triggers auto backup so follow the below steps without skipping a step.

Try not to make it more difficult than it needs to be. Yes bugs can be introduced in either the server or the app as a user you do need to do some basic troubleshooting to work around things. What worked one day may not be the same the next day, things happen and thats why there is documentation and troubleshooting steps. All you have to do is make sure the URLs are there and provide the Home WiFi SSID and leave location on, the app will handle the rest.