android: Unable to connect to Home Assistant error when playing video opened from notification

Home Assistant Android version: beta-2484-0e0994de-full

Android version: Android 12 Android 13 (Beta)

Phone model: Pixel 4a (5G) Pixel 5 (in a VM)

Home Assistant version: 2022.7.5

Last working Home Assistant release (if known): N/A

Description of problem: When playing a video clip opened from a notification I receive the error “Unable to connect to Home Assistant” The video continues to play behind the error message

The issue is present on my primary Pixel 4a (5G) running Android 13 Beta 4 and the beta release of HA. This issue was present when I was running Android 12

The issue is also present on a Pixel 5 VM running Android 12 stable

To further clarify, the issue happens when accessing a video from /api. The URL format is as follows /api/frigate/notifications/{{id}}/{{camera}}/clip.mp4

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

Debug Log from Android Studio VM android_studio_log.txt

Debug Log from In App homeassistant_companion_log_6-16-2022_12-9-36.txt

Screenshot of problem: image

Additional information:

  • I have reviewed Issue #2325 but I was still unable to solve the issue by restarting Mosquitto. To further clarify, I’ve rebooted everything.
  • I am running Home Assistant behind nginx using the SWAG docker container. I have confirmed this issue is present when connecting directly to the HA docker IP.
  • I am using the new mTLS option but the issue was present before implementing this. Also the issue is present when accessing the docker IP directly thus bypassing the mTLS auth.
  • I have not ruled out that this could be an issue with the Frigate Integration

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (15 by maintainers)

Most upvoted comments

I still intend to work on this at some point especially now that I have Frigate running in production. I just have not had the time to sit down and take a look at it.

Just tested this morning and it works well.

Hey everyone took an attempt to fix the issue. For anyone who wants to test the fix please download the artifact from https://github.com/home-assistant/android/actions/runs/3933174642 and extract and install the debug apk. You will need to enable the persistent connection to send a test message with the video or whatever else you sent when you got the error, firebase messaging does not work in debug builds. I also recommend giving a unique name during onboarding so you can easily tell which service call to use. The debug builds are designed to be installed side by the production one and are safe to remove after testing.

If you do still encounter an issue please share the YAML of the service call so we can see what the URL looks like

I do not think this is a good approach. You can already do this by specifying the absolute path with the FQDN to open in the browser. It only opens in app when using the relative path.

Its not the same though, relative path forces the app add authentication. Opening in the browser requires the user to do so, we would just be adding auth to the request and opening it that way. It makes sense for the app to open a relative lovelace path, but not an API path which has no frontend UI.

Having the ability to open a video in app adds to the app UX making it feel more polished (save for the current error).

There is no app UX though, our webview activity is plain without any UI added. Any UI you see is from the HA frontend. The benefit of a browser is that the user can close the tab, you can’t do that in our app as there are no tabs.

I wonder if we detect an API call if we should just load it up in the browser instead of the apps own webview activity to avoid this.

I do not think this is a good approach. You can already do this by specifying the absolute path with the FQDN to open in the browser. It only opens in app when using the relative path.

Having the ability to open a video in app adds to the app UX making it feel more polished (save for the current error).