Device Tracker not updateing GPS Location, gecodedlocation does

Since a few days home assistant does not update the device tracker anymore. The geocoded location is updated correctly. I have reinstalled and connected the app several times. Does anyone have the same problems ?

Here are some screenshots:

2020-07-07 10_10_29-Window 2020-07-07 10_11_02-Window

same problems here, no accurate location and no frequent update,
my daughter is on the couch now for more then 2h. and stil she’s not home according to HA. ???

I do have the same problem. Using on Samsung S8.

Same problem here, I have 2 devices (Lenovo TB-X704L tablet with android 9 and OnePlus 6T phone with android 10) and the phone is still shown on my way from work since friday afternoon. It doesn’t affect presence detection, as I use both phone and tablet in both mobile_app and device_tracker luci (openwrt) so one of them always catches me leaving / arriving, it’s just annoying. The tablet works more or less as expected.

I tried owntracks, which only worked when I manually pushed the location or in the mode where it eats battery like it’s candy (and even in this mde sometimes only updated when unlocking phone and actually looking at the notification). If I open google maps or any other map app it immediately gets correct gps position. HA mobile app is excluded from battery optimisation on both devices.

edit: I’ve had this issue since I;ve started using HA which is about since 6 weeks ago.

1 Like

Same problem here, using two Xiaomi Mi9T.
Geocoded Location shows the real position, but the device tracker isn’t updated.

same issue here
condivision is perfect but on HA not updated
any ideas?

I’m just realising now I’m seeing the same issue for my wife’s Huawei device.

The app is accurately and quickly reporting details such as current Wifi network, battery discharge state etc.

The Geocoded location sensor displays the correct raw GPS location data, written address etc but the device_tracker remains at state ‘home’ (instead of ‘not_home’) and the GPS location data within that entity is also incorrect (not updated). This does not happen 100% of the time, and is sometimes resolved by opening the app.

This never happens with my Xperia (same version of android app).

So essentially, it appears that the app is reporting location updates correctly (as evidenced by the geocoded location sensor), but the device_tracker entity is not receiving these updates in a timely manner, if at all, for unknown reasons.

Great news here, I’ve managed to fixed the issue with an automation and some scripting :slight_smile:

What I did, is set up an automation which is triggered every minute (you can choose your own rate) that will retrieve the value of my phone geocoded location and update the device tracker value.

You need to have python script (https://www.home-assistant.io/integrations/python_script) activated on your HA for my solution to work.

Here is the automation that updates both my wife and my device_tracker (there is one action/device tracker so add/remove as much as you need):

- id: LocationUpdater
  alias: Update Device Tracker Location chronically
  trigger:
    platform: time_pattern
    minutes:  "/1"
  action:
    - service: python_script.update_device_tracker
      data_template:
        entity_id: "device_tracker.gagooga_mi_9t"
        latitude: "{{ state_attr('sensor.gagooga_mi_9t_geocoded_location', 'Location')[0] }}"
        longitude: "{{ state_attr('sensor.gagooga_mi_9t_geocoded_location', 'Location')[1] }}"
    - service: python_script.update_device_tracker
      data_template:
        entity_id: "device_tracker.wife_mi_9t"
        latitude: "{{ state_attr('sensor.wife_mi_9t_geocoded_location', 'Location')[0] }}"
        longitude: "{{ state_attr('sensor.wife_mi_9t_geocoded_location', 'Location')[1] }}"

And here is the python script which is called:

inputEntity = data.get("entity_id")
inputLatitude = data.get("latitude")
inputLongitude = data.get("longitude")
inputStateObject = hass.states.get(inputEntity)

inputAttributesObject = inputStateObject.attributes.copy()

if inputLatitude is not None:
    inputAttributesObject["latitude"] = inputLatitude

if inputLongitude is not None:
    inputAttributesObject["longitude"] = inputLongitude

hass.states.set(inputEntity, inputStateObject.state, inputAttributesObject)

Enjoy that fix as much as I do :wink:

2 Likes

There were a few location issues introduced when the minimal version of the app came to light. Can you guys try the latest version that contains the accuracy fix merged last night? Its build 241, its not just this fix in particular but a few fixes were added since 2.0 to the beta

Hi

I checked this, but unfortunatelly, it doesn’t work for me…
I changed entity_ID and latitute and logitude in state attr to correct one, automation seems to be executed, but nothing happens with update…

Yeah I have this issue my phone never updates the GPS :frowning: checked all the settings etc but still nothing

What phone? And are you sure you looked at everything? Some phones have different names for things so you may need to look at other settings that would do the same thing.

I have all the latest updates of both Home Assistant and the iOS app (not beta version). Though, I encountered the issue this morning.

Samsung Galaxy S10+
Seems after last update, now it works even without this automation. Interesting I have to say :slight_smile:
Thank you for interest!

iOS? i think you may be in the wrong thread :stuck_out_tongue:

My wife has a Samsung A8. It almost never updates it’s location. It does so very occasionally.
I tried with Googlegeocode-HASS addon but that doesn’t work either. The phone just doesn’t update it’s geocoded location.

Doublechecked all location and battery settings both in the companion app and in the A8.
Is this a known issue with the A8?

1 Like

https://dontkillmyapp.com/samsung somethings to check in here.

Thanks! It was worth a check. I have adjusted some settings. Let’s see how it goes from now.

I think you need to manual enable one important permission - allow companion to Auto start , after that reboot the phone at least once. I had such problems, this permission fixed them

1 Like

Touché, though, I did have the same issue :stuck_out_tongue: I have not seen it since.