home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.27k stars 629 forks source link

HA Companion no longer connecting to server #3979

Closed ReconDom closed 9 months ago

ReconDom commented 11 months ago

Home Assistant Android app version(s):

Android version(s): android ver 11 and android ver 8.1

Device model(s): samsung galaxy A20 phone and samsung sm-t580 tablet

Home Assistant version:2023-10-5

Last working Home Assistant release (if known):

Description of problem, include YAML if issue is related to notifications: both the phone and tablet no longer connect. The cached data was purged and app re-installed. Verified the IP address on the HA network page and the router and the, not working tablet (http://192.168.50.212:8123) but continue to get time out error when the companion app does initial setup. Problem did not resolve when older version of HA was restored.

Companion App Logs:

Screenshot or video of problem:

Additional information:

dshokouhi commented 11 months ago

This is not an error for the app to solve. Time out errors and other network related errors are ones for the user to fix. Have you tried rebooting your HA host?

ReconDom commented 11 months ago

Ahem, ok. I was hoping to see a 'oh ya, we all have this problem and this is what we done...' But ya I have rebooted all devices, the HA server and the router. The router sees the phone and tablet and HA but the companion app no longer finds the HA server....

timbrueggenthies commented 11 months ago

@ReconDom i actually have the same problem since yesterday (Updated to Homeassistant 2023.11). My Phone and my Tablet does not seem to be able to connect via the App, i get the Error dialog after about 5-8 seconds.

I verified that the phone itself is able to connect, because i can access the homeassistant dashboard via the browser.

mcfrojd commented 11 months ago

I'm experience a similar issue, at first i thought that the app was not able to connect when the message "Could not connect" appeared on the screen. But if i wait a couple of seconds it does in fact connected, but it takes 18-21 sec in total to get to the interface. (In the video below i'm NOT clicking on any of the options when the "Could not connect" appeared on the screen.)

https://github.com/home-assistant/android/assets/7395495/5fd7cbb1-2b61-42fb-b36b-7e76c17ddedd

This behavior started after the latest updates of app (2023.10.2-full) and HA (2023.11.0). The behavior is the same if im on my local wifi or mobile. I'm not using nabu casa cloud, im using an reverse proxy.

dshokouhi commented 11 months ago

@mcfrojd that slow loading is all coming from either your network or HA frontend. As you said you have a reverse proxy try restarting it and/or restarting the HA host to see if that solves the issue.

The app will indeed show the cannot connect pop-up if it does not get a response from the HA frontend in 10 seconds or if teh HA frontend reports an error. Errors can be found in the companion app logs from the pop-up click on Settings > Troubleshooting > Show and Share logs.

@timbrueggenthies you should also check the logs like above

timbrueggenthies commented 11 months ago

Thanks @dshokouhi, I found my problem. The App (or maybe accidentally me the last time I used it) switched to another HA instance that is not reachable from there. Maybe it would be an improvement to show which HA instance is trying to connect in the error dialog.

azerioxal commented 11 months ago

I'm experience a similar issue, at first i thought that the app was not able to connect when the message "Could not connect" appeared on the screen. But if i wait a couple of seconds it does in fact connected, but it takes 18-21 sec in total to get to the interface. (In the video below i'm NOT clicking on any of the options when the "Could not connect" appeared on the screen.)

https://github.com/home-assistant/android/assets/7395495/5fd7cbb1-2b61-42fb-b36b-7e76c17ddedd

This behavior started after the latest updates of app (2023.10.2-full) and HA (2023.11.0). The behavior is the same if im on my local wifi or mobile. I'm not using nabu casa cloud, im using an reverse proxy.

I'm having the same issues. Connects fine from the browser and does the same thing even if connecting over the IP.

I've been trying to find anything in the logs, but haven't had any luck. Clearing storage and completely resetting the app fixes the problem for a while.

For some reason, I can't get remote debugging to work, but I've been able to see that there are loads of webview instances opened and detached when the issue occurs, but only a few that are open right after a reset.

Hopefully I can get remote debugging to work completely instead of disconnecting after a few seconds and can take a better look.

I also only have one instance, so it shouldn't be an issue of picking the correct server.

MrRiZZaH commented 10 months ago

Hm same here, wall mounted android monitor can no longer connect to HA. Deleted the server info and tried re-adding, when I enter a wrong url it gives a popup that there is no HA server on that address, when I enter my correct information a blank page happens. Nothing shows up in HA logs.

dshokouhi commented 10 months ago

when I enter my correct information a blank page happens

this could be caused by outdated webview on the tablet, make sure its upto date from the play store

MrRiZZaH commented 10 months ago

when I enter my correct information a blank page happens

this could be caused by outdated webview on the tablet, make sure its upto date from the play store

Tested with latest app and same happens. If I put in the direct IP of my home assistant it says the cert could not be validated (normal), if I go to the url with valid cert a blank page happens. I have done a full factory reset and upgrade of the tablet in the mean time and the same persists, the problem has to be HA at this point.

dshokouhi commented 10 months ago

I have done a full factory reset and upgrade of the tablet in the mean time and the same persists, the problem has to be HA at this point.

what tablet is it? and what is the version and package name of WebView?

MrRiZZaH commented 10 months ago

I have done a full factory reset and upgrade of the tablet in the mean time and the same persists, the problem has to be HA at this point.

what tablet is it? and what is the version and package name of WebView?

I just realized webview is part of the system and not part of the HA app. My tablet is an Akuvox C315S Indoor Monitor. It allows to install 1 app. There is no playstore on it. Do you perhaps know since which version this updated webview component is needed so I can downgrade HA?

dshokouhi commented 10 months ago

Do you perhaps know since which version this updated webview component is needed so I can downgrade HA?

I am not sure, the android app uses the WebView to display the HA login page as well as the dashboard. Ensuring webview is kept up to date is important to make sure everything works as expected. Are you able to sideload Google's version of WebView and select it as the default WebView on your device? If so that might work.

What is the behavior of the URL on chrome for android on the same device?

MrRiZZaH commented 10 months ago

Do you perhaps know since which version this updated webview component is needed so I can downgrade HA?

I am not sure, the android app uses the WebView to display the HA login page as well as the dashboard. Ensuring webview is kept up to date is important to make sure everything works as expected. Are you able to sideload Google's version of WebView and select it as the default WebView on your device? If so that might work.

What is the behavior of the URL on chrome for android on the same device?

Sadly not able to install anything to the device other than 1 apk. Choosing a different one removes the other. I swapped it for a browser and the same happens, blank page on the external url, internal url works but ssl error. I did a roll back to last month when all was working and no difference, I can't figure out what else would have changed.

dshokouhi commented 9 months ago

Based on everything I have seen so far the solutions seem to be different for users given the use case. Now that we have slightly different issues I am going to close this issue and request if you still face an issue please open a new issue with logs so we can determine what going on. I thnk a few users already got things resolved for them as well.