Android pixel 6 pro - location failed to send when not on wifi

I haven’t been using widget or device control. However, I just setup device control on my phone and can confirm it is unable to function when not on my local network.

So I think your hunch about the APIs not working is correct. In fact, I am getting WAF log entries for the API endpoints right now. Not sure why those weren’t appearing before but, hey, it’s progress.

With that being the case, is there for the API requests to present the required mTLS certificate, so that it can get past my WAF?

to my understanding all the auth stuff there is handled when you login to the app and select the cert if that is working then the api should too

I uninstalled the Home Assistant Android app and reinstalled it. After entering my external HA URL, it correctly prompted me to select a certificate. I selected my certificate and the app loaded my dashboard just fine.

However… it’s still unable to update location and device control is erroring. So it appears it still can’t reach the API.

So, for some reason, the app is using the mTLS certificate but the API is not… or at least that is my best guess.

used in all of our calls actually, that was a requirement when the feature was added: android/common/src/main/java/io/homeassistant/companion/android/common/data/HomeAssistantApis.kt at c4cca92e93e2db3a034ef469b6b91c14337225f8 · home-assistant/android · GitHub

Okay so I figured out what was causing the problem.

I thought the problem was with my Cloudflare tunnel’s WAF. When the real problem was a Cloudflare “application” I created to allow me to securely interact with Home Assistant’s API endpoints, utilizing Cloudflare’s zero-trust functionality. The security measures I put in place for the API was, obviously, blocking the Android Home Assistant app from being able to access it.

Honestly, I can’t believe I had forgotten I had set that up. Must have been a late night of coding.

I guess for anyone else who stumbles onto this issue: If you’re using Cloudflare and having similar problems, be sure to check all rules you have in place, across all of their variety of security features.

2 Likes

I have the same issue with Pixel 9. It was working great on Pixel 5 before.
The error I see in logs once I leave my home is

04-30 11:59:39.802 29343 29388 E SensorReceiverBase: Error while getting core config to sync sensor status
04-30 11:59:39.802 29343 29388 E SensorReceiverBase: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.net.UnknownHostException: Unable to resolve host "hooks.nabu.casa": No address associated with hostname

It starts working again once I open the HA app.

Looks like a local DNS issue, the app won’t be able to fix that but you should be able to on your network.

Yeah, it did look like a network/DNS issue at first, but the real problem was on the system/app level. Disabling Adaptive Battery in Android and enabling background access for the Companion App in the app settings fixed it for me. Now location updates work reliably.