Show location from Companion app sensor on a map

The Android Automotive (not Android Auto, or maybe that does the same) companion app used to give coordinates that easily showed the location on a map card on the dashboard. That has changed a long time ago and I have been trying to fix it ever since. Without any result. I’m missing something.

The companion app provides a sensor with a geocoded location:

There is an attribute with comma separated digital coordinates (location). I understand I need to create a device_tracker with those coordinates to be able to show on a map card. But I just can’t find a way to create a working device_tracker for this. I have seen may examples of similar challenges, but can’t get anything to work.

Anybody succeeded in this?

As far as I approached it, I linked the device to a person and in the app you enable geolocation sensor.
With that you see persons on the map.

But this is assuming your automotive app has the same settings

Since it’s a sensor then I don’t believe it will work to add it to a person.

You need to use the service call device_tracker.see.
Just search for it and you will find a lot of examples of how it’s used

I had spend hours trying to understand the device_tracker.see service already. I have spend a few more and now I finally got it.

I added below automation to call the device_tracker.see service. It creates/updates device_tracker.polestar_1565_location when the geocode location sensor from the P2 companion app is updated.

#
# AUTOMATIONS
#

automation:

    # Create device tracker for the Polestar 2
  - description: Get GPS location from Geolocated sensor
    alias: POLESTAR - Update GPS location
    id: 31156193A3
    
    trigger:
      - platform: state
        entity_id: sensor.polestar_geocoded_location

        
    condition: []
    
    action:
      - service: device_tracker.see
        data:
          dev_id: polestar_1565_location
          gps: "{{ state_attr('sensor.polestar_geocoded_location', 'location') }}"

    mode: single  
        
# END