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

I’m having issues with my location not being updated when I’m not on wifi. In the companion app logs I see " background location failed to send"

I have the app connected to cloud in the settings and it works fine to control devices but I see this issue as soon as I turn off WiFi.

As soon as WiFi is back on it starts sending the location again.

Data saver is turned off and app has full access to my location all the time.

Any pointers?

Thanks
Stu

settings > companion app > select your server

confirm your settings here, if you have teh Use Cloud option checked try to uncheck it and check the URL there.

So I turned off the use HA cloud option and made sure the URL was set to my ha cloud URL manually which is actually a custom URL but fully validated and all works fine when accessing either via app or browser but still get the failed to send message in the location debugging.

Any other thoughts?

yes whats the failure from the logs?

https://companion.home-assistant.io/docs/troubleshooting/faqs/#device-tracker-is-not-updating-in-android-app

these steps go over proper settings annd looking at logs and tracking history

Ok, so I tried all this and did nothing but did the starting fresh and that works although I’m oddly having notification issues with android phone - iPhone works fine

Using the developer tools service and automations iget the following error
“Failed to call service notify.notify. Device not connected to local push notifications”

The notifications work fine if I send to the specific android device though.

Persistent connection is set to never

I am having the exact same situation (Pixel 7 Pro). I am new to HA so this is the first time I’m setting up the companion app. Companion app does not update unless I’m at my home location. I have followed all steps in the troubleshooting post.

Insterstingly, I am coming to HA because I have been having issues with location tracking with my Smartthings system for a while. Now I am starting to think it is a phone issue.

Logs on the companion app say “background location - Failed to send”

Now look at the logs from the previous menu under troubleshooting you should see the actual error there. It will help give a clue as to what’s going on.

Determined my issue was a lack of HA cloud implementation.

I thought the GPS device tracking could be used without cloud, similar to the notify service.

The app needs a way to send data back to the server

I have a similar problem.
I’m using Nabu Casa cloud connection and can manage all aspects of my HA from anywhere.
My phone with companion app only reports location successfully while at home, and has Location failed to send messages when away.

My wife’s phone reports wherever she is, and so do my children’s, so this can work.

I was the first to install the companion app, while setting up HA, and I probably messed with the settings.

End result is that from HA point of view, I never leave home, home is always occupied, and the heating never turns down.

What do I need to do on my phone?

First update both HA and the app. Next log it of the and log back in. Sure that fix the issue?

I deleted the app and reinstalled it, after first checking that I could log in to Nabu Casa and retrieve my URL.
Login to the app, while away from home, via Nabu Casa worked seamlessly.
Location now works and there is nobody home.

My wife is also using a Google Pixel device (Pixel 7a) and has similar issues.
When on the home wifi the location updates without problem.
When on mobile data the location does not update, while I can still turn on/off my lights etc?
Like others here when I look in “Troubleshooting” in the “Location tracking” history I have the error “Background l Location * Failed to send”.

Similarly other device data (like whether the ringer mode is normal or silent) do not update.
I didn’t change any setting just clicked around a bit in the server connection setting in the home assistant companion app and now it seems to be working.

We’ll be going out soon so I’ll see if location tracking works well now.

Well at least I occasionally got location updates this time on my wife’s phone (though only a tenth of the frequency with which my own phone sent updates).
Her phone also still showed errors.
Here’s an example:
05-20 13:14:15.515 12283 29162 E LocBroadcastReceiver: Caused by: java.net.ConnectException: failed to connect to ha.qaudrilant.a599.ae/54.115.6.208 (port 443) from /18.78.169.118 (port 42032) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)

But on other occassions the logs just says it failed without giving any reason:

05-20 17:02:19.343  4734  4734 D LocBroadcastReceiver: Received location update.
05-20 17:02:19.346  4734  4734 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
05-20 17:02:19.347  4734  4781 D LocBroadcastReceiver: Last Location: 
05-20 17:02:19.347  4734  4781 D LocBroadcastReceiver: Coords:(40.7502529, 2.3464987)
05-20 17:02:19.347  4734  4781 D LocBroadcastReceiver: Accuracy: 20.0
05-20 17:02:19.347  4734  4781 D LocBroadcastReceiver: Bearing: 0.0
05-20 17:02:19.347  4734  4781 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
05-20 17:02:19.347  4734  4781 D LocBroadcastReceiver: Received location that is 1045 milliseconds old, 1716217338302 compared to 1716217339347 with source fused
05-20 17:02:19.355  4734  4781 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
05-20 17:02:19.411  4734  4781 E LocBroadcastReceiver: Could not update location for 1.

More logs here: SUCCESFULL UPDATE:05-20 15:26:59.621 12283 12283 D LocBroadcastReceiver: Rec - Pastebin.com

Chiming in to say that I’m having what I think is the same issue on my Google Pixel 9 Pro.
It seems that background updates aren’t working properly when not connected to WiFi. When I’m at work I’m only connected to Cellular data, and lately this has often resulted in no location update. Specifically my Zone is not updated.
I can see that my geocoded location is updated correctly, but HA is not recongnizing that my Zone has changed from Home to Work.
Opening the app and leaving it on for some minutes will eventually remedy the issue.
Clearing ALL app data will fix the issue temporarily. This however has the side-effect of creating new device and entity entries for my phone, breaking my phone-related automations…

The error logged in Location Tracking is “Failed to send data”. I unfortunately couldn’t find entries from that time in the “Show and Share Logs” section due to the limited number of entries available.

Edit: A few minutes after posting it happened again, and this time I managed to get log data from around that time.
11:26 is when “Failed to send data” occurred.
Log can be found here.

see the error but we have no traceback to go by so not sure what caused it to fail

02-10 11:26:26.326 16942 22191 E LocBroadcastReceiver: Could not update location for 1.

we need to see the full error so we can make suggestions for the fix

I’m running into this exact same issue.

Does this log snippet provide the information you’re looking for?

UPDATE WITH MORE INFORMATION:
In case the data you need isn’t in that smaller log snippet, here’s a much larger chunk of the log (still had to trim it down to meet Pastebin’s limits): --------- beginning of system02-15 12:13:59.551 16688 16688 V ResourcesManager - Pastebin.com

Also, for greater context, I do have my Home Assistant externally available through a Cloudflare Tunnel (requiring an mTLS cert). I was wondering if that was part of the problem and, while I do see some HTTP 403 errors in the logs, I do not believe it’s related to my Cloudflare mTLS, as the rest of the applicaiton works fine and my Cloudflare WAF logs are not showing any blocked attempts on its end either.

I cannot express how much I appreciate your help! I’m about a month into my HomeAssistant journey and community members such as yourself are why the ecosystem is so great.

ok heres the relevant failure thats the same for all calls that fail after it so not just location updates but also sensor updates appear to be failing:

02-15 13:14:06.973 16688 16749 E SensorReceiver: Error while getting core config to sync sensor status
02-15 13:14:06.973 16688 16749 E SensorReceiver: io.homeassistant.companion.android.common.data.integration.IntegrationException: retrofit2.HttpException: HTTP 403 
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.getConfig(IntegrationRepositoryImpl.kt:533)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl$getConfig$1.invokeSuspend(Unknown Source:14)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:99)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
02-15 13:14:06.973 16688 16749 E SensorReceiver: Caused by: retrofit2.HttpException: HTTP 403 
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at retrofit2.KotlinExtensions$await$2$2.onResponse(KotlinExtensions.kt:53)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:161)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:529)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
02-15 13:14:06.973 16688 16749 E SensorReceiver: 	at java.lang.Thread.run(Thread.java:1012)

are you allowing all api traffic to the app? HA has a variety of different apis that the app uses

are there any HA core errors at the same time?

if you havent already seen this page it has some helpful hints that may be of use https://companion.home-assistant.io/docs/troubleshooting/networking#tls-client-authentication

“are you allowing all api traffic to the app? HA has a variety of different apis that the app uses”

My Cloudflare WAF rule allows (if you have the correct mTLS cert or is coming from a Google IP address) access to my entire Home Assistant domain. So, I believe, it should have access to all of the APIs.

I’ve been checking my Cloudflare WAF log, wondering if that’s the problem, and I’m not seeing any blocked requests which is good as I installed and selected the mTLS certificate my WAF requires.

“are there any HA core errors at the same time?”

Doesn’t look like it.

“if you havent already seen this page it has some helpful hints that may be of use Companion App Networking | Home Assistant Companion Docs

I believe I have the cert installed and selected correctly. The application itself works fine when I’m away from home and there aren’t any requests being blocked by my Cloudflare WAF.

the app itself is authenticated webview other pieces like location and sensor use APIs.

do you have widgets and/or use features like device controls? do those work remotely? in device controls can you see the state and control when not at home?