iOS device_trackers unknown for multiple devices on 2022.11.2

I first encountered this issue when upgrading to Core 2022.11.1. My person.xxx entities no longer had locations. I didn’t investigate beyond rolling back to a backup, which fixed the problem.

Since then, I have upgraded to 2022.11.2 and now have the same problem. I’ve found that my iOS devices have valid geocoded locations, but the associated device_tracker.xxx entities have values of “unknown.”

I have deleted the iOS integration from HA. I have deleted the app from the iOS device. I have manually deleted the device.tracker_xxx entities from HA (restarting HA between steps). None of this has corrected the issue or resulted in updated device_tracker.xxx values. There are no redundant or other related device_tracker entities, except from those tied to my router integration. All other iOS device entities like battery state, battery level, steps, storage, SSID, are all updating correctly.

I’m at my wit’s end and I’m thinking about rolling back to 2022.11.0 to see if that will fix the problem again.

EDIT: Rolled back to a backup, but not far enough apparently. Still on 2022.11.2, and the device_tracker.xxx entities are still unavailable.

Why? I can’t get this working, at all, now. I’ve rolled back and I’m using the same configuration.yaml, etc. I’ve deleted the Companion apps, deleted all related entities in HA, restarted, rebooted phones, and nothing is getting the device_trackers to update. If anyone can help me figure this out, I’ll buy them a coffee.

I now have a HA instance with 2022.11.0, then imported all of my latest configuration.yaml, customize.yaml, Lovelace dashboards, template sensors, Node-RED flows, etc… and no mobile devices. I’ve deleted every entity related to my mobile devices (no device_trackers remain) and backed this up. There is no reference to the mobile devices in the YAML files I brought back in. There are a few references in the Lovelace views to the device_trackers, but that just renders them… unrenderable.

I have also deleted the HA companion app from all of the phones and rebooted those devices. They have sat restarted clean for the last few hours. I want to proceed with re-installing HA on them, but if it doesn’t work I’ll have truly hit a dead end. Seeking any advice.

Still not working. What am I missing?!?

OK, I’m trying to create a new Device Tracker from the GPS coordinates of my mobile device.

Here’s the template sensor:

  - sensor:
    - unique_id: location_person1
      name: Location Person1
      icon: mdi:map
      state: >
        {{ state_attr('sensor.person1_iphone_geocoded_location','Location') }}

The state of that sensor is [ xx.xxxxxxxxx, -xx.xxxxxxxxx ], where the x’s represent integers.

Then I’m using the device_tracker.see service to create/update a new device_tracker with the coordinates of the template sensor. But no new device_tracker is being created with this automation:

alias: Device Tracker Update Person1
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.location_person1
condition: []
action:
  - service: device_tracker.see
    data:
      dev_id: person1
      gps: "{{ state_attr('sensor.person1_iphone_geocoded_location','Location') }}"
mode: single

There is no new device_tracker entity (in fact, no device_tracker entities at all) in known_devices.yaml. I’m hitting walls at every turn.

EDIT: I’ve now been able to add new device_trackers to known_devices.yaml by using 100% of the sample entry data (Dave is now a device_tracker entity I can’t get rid of). However, I can add only static GPS coordinates, and even though I’ve just deleted all of the new device_tracker entities from known_devices.yaml, they still appear in the UI, even after rebooting HA.

That it is both ‘unavailable’ and ‘restored’ makes me think this is not the integration’s device_tracker for the device whose geocoded location is showing up there. Do you have more than 1 mobile_app integration (the ios integration is not used for this entity) for the device?

Generally I do, but at this stage, no. Neither of the two is working, so I deleted the mobile app & integration/entities for the other device. The device_tracker shown is the only one it could be, and during the several times I’ve deleted, restarted (HA & mobile), then re-installed, this is the device_tracker that comes back along with the other 17 entities related to the mobile app.

I wish it were that easy. If there were another device_tracker associated with this device, I definitely would have seen it. Aside from that… there is not one device in known_devices.yaml that has GPS coordinates.

I can successfully call this service through the UI, with the data below (simulated coordinates):

service: device_tracker.see
data:
  mac: FF:FF:FF:FF:FF:FF
  dev_id: person1
  host_name: Person1
  location_name: home
  gps:
    - 86.22772216796875
    - -38.78302125110847

This does not add an entry to known_devices.yaml. It does update an entity called device_tracker.person1_2 with the information above; there is another device_tracker.person1 that does not get updated. There is also a device_tracker.dave that is also not in known_devices.yaml that I created using all of the sample data. #1 would solve my problem, and I’d like to do #2 and #3 as well:

  1. add dynamic data to the GPS key for one of the device trackers
  2. delete the unnecessary device_tracker.dave
  3. delete the unnecessary device_tracker.person1, then rename the one that’s actually updating so it’s consistent

I don’t believe the app devices will show up in the known list. Does the Location History (in the app settings under Location) show any locations that the app sent to the server?

The ones I’ve been trying to add aren’t app devices; I’ve been running device_tracker.see to generate new trackers to use in place of the app device_trackers. I’m also failing at that.
EDIT: I see what you mean… the mobile app device_tracker entities wouldn’t show there. I’m being a bit reactive. Every time I get back into this, my frustration builds.

Yes. I’ve cleared them out a few times today, but since I just got back home and had my mobile with me, there’s been a bunch of valid location reporting:

The only thing I can think of that might work that I haven’t tried yet is creating a template sensor with Latitude and Longitude attributes. I’m not exactly sure how to do that yet, though. All of this is one big massive workaround for something that was working just fine for nearly two years and until a few days ago.

Just chiming in to say that I’ve had this problem on Android for probably around six months that looks just about the same: the device tracker shows up as unknown even though the geocoded location is being populated. So, I don’t think it is an iOS specific issue and it also doesn’t seem related to a certain time frame if yours just started a few days ago.

I’d love a solution, but haven’t found one yet :confused:

1 Like

My hunch is that something is broke with that device entry and we can maybe resolve it harshly. Try the following steps:

  1. Delete the app
  2. Delete all mobile app integrations
  3. Restart HA
  4. Confirm the device tracker is gone entirely (if it is not, that means it is not the app’s device tracker that’s the reason for the disconnect)
  5. Reinstall the app
  6. Confirm you only have the one integration
  7. Confirm the device tracker is around

Additionally, please confirm:

  1. You only have 1 server in your app’s configuration for this server
  2. The privacy permission for locations there is “Exact”

In fact… I’ve done these exact steps… twice, now. I know it’s easy to say, “I’ve tried that already,” but after failing to get it to work by rolling back to several different backups, I started from my oldest backup and deleted all mobile device apps, deleted all references to every device_tracker, imported my latest configuration.yaml, template sensors, Node-RED flows, etc.—none of which define a device_tracker—and then backed up again.

So now I have a backup with no mobile devices, no app-created device_trackers, and I started fresh from there yesterday, after waiting a day using only the scrubbed backup. I re-installed HA on my iPhone, crossing my fingers (because what else can I do at this point), and… same thing… Mobile app integration appeared with 18 entities. Device_tracker created, set to unknown. Geocoded location works as expected, updates quickly. Location reports from the app both manually and with significant location change. I have only re-installed on one device in the last few attempts. All references to the other device were deleted several backups ago.

I’m at a complete loss. I can’t think of what I did to first cause this, but it occurred when I first upgraded to 2022.11.1 on both devices simultaneously, so my “baseline” backup now sits at 2022.11.0 but I still can’t get the device_trackers functional.

I have only one server in the Companion app. Location Accuracy is set to “Full.” Screen shots are above. I even toggled “Precise Location” in the iPhone privacy settings after initial startup (“off” doesn’t allow the app to update location). I don’t know what else to try. I’m prepared to roll back to baseline at any time, but I’ve run out of ideas as to where to go from there. There was a comment on one thread that this might be caused by the “Use Zone Name” setting in the app, under Sensors —> Geocoded Location. I’ve toggled that and rebooted, updated location… nothing. I appreciate your willingness to respond, as I’m getting no other help on this. I’ve dug deep in these forums for a solution, and I’m hitting slabs of granite.

EDIT: This morning, I:

  • deleted the iPhone app and rebooted
  • rolled back to my baseline backup. The only device_tracker entities are from my router.

My iPhone sits without HA installed. The other device has been without HA for two days.

OK, so we went from no device_tracker without the app set up, to one that’s ‘unknown’ with the app set up. That’s good, sorta.

All of the sensors (e.g. geocode) should be unrelated to the device_tracker as that’s updated entirely separately from sensors. The privacy setting I’d like you to check is in the app’s settings > [Your Server] > at the bottom, what is the value set to “Location Sent” under Privacy there?

Well, I just managed to fix mine. This wasn’t the exact solution, but put me on the right path. I had checked the app permissions many times and messed with the sensors from my admin account, but had never went in and checked the sensor settings in the app configuration menu from the user’s view… I wasn’t aware that the sensors could be enabled in HA but disabled in the user’s app.

Still unsure why they randomly disabled themselves on that one device though, must’ve been some OS privacy update or something.

OK, with this in mind I just installed the app on my iPhone. I know I didn’t answer this earlier, but as far as I can tell, it’s always been set to “Exact”. This is how it appeared when I installed the app:

The mobile device_tracker is back, and unknown. I won’t do the screen shot thing this time, but here’s the text:

device_tracker.xxxxxxxxxxxxx_iphone
xxxxxxxxxxxxx iPhone
unknown	source_type: gps
friendly_name: xxxxx iPhone

I got a bit nervous because there were only 17 entities. xxxxxxxx.geocoded_location was missing. I manually updated location in the app, and that entity appeared. It took about 30 seconds for the full details to appear, but they’re reported and all 18 entities are in HA.

So far, it’s the same as every restore/reinstall I’ve done in the past few days. Where do I go from here?

OK, my hunch now is there’s maybe an issue in core, but let’s take a look at what data the app is sending to make sure it isn’t containing some kind of erroneous information. This may be private information, so can you send it out-of-band? The best way to do this is either:

  • Tap into one of the location history entries and copy the text (hit the share button) [this may not be enough information to debug but includes just the location update’s information]
  • Go into Debugging and Export logs [this includes a lot more information like your instance URLs and things like entity names the app sees]

You can either email them to [email protected] or attach them in this Dropbox file request. I won’t send the information to anybody else, and I’ll delete it after I’m done.

Oh an secondarily: any error/warning logs in your HA server related to this?

I’ve just sent you three emails:

  1. Shared location history entry. I didn’t know that was possible.
  2. Export of HA Companion app logs
  3. Logs from HA. I didn’t see anything related to the device_trackers, other that what I noted in the email.

I appreciate your help and your discretion with the data.

Did you redact the location debug information? If not, can you try assigning a latitude and longitude to your home/server and seeing if that resolves this?

From the app debug log? No… I didn’t even preview it. Where should I make that assignment? I don’t see anywhere in the Companion App to do that.