Custom device tracker with GPS coordinates and show on map

I created a sensor that able to get current location (detailed street name) of a car, and i want to make this car show in the map, so i know how far it is to a zone.

Here is my though:

  1. Get current location (street name, build number etc) of the car in every 1 min
  2. Search the location info in to get lon and lat with (Search - Nominatim Documentation)
  3. Create device tracker entity with lon and lat
  4. Show the entity on map

My question as below:

  1. How do i create a sensor that picks up the info step 1 above, is this possible?
  2. How do i create a device tracker? From the document, it seems i must have a mac address or host. Am i not able to just use lon and lat to create this tracker? or this is not the right approach.

I’ve also downloaded ‘places’ from HACS, but it seems my major issue is setting up a device tracker of the car.

Background story:
I live in a place where a car will pick up trash at a certain time, its really annoying i don’t know where the car is when the estimate time is always wrong. Luckily they provide car’s current location, but i will need to input the address to google map and see where it is… so i want to use HA to show the car on map directly, and set zone to notify me when its near to my zone.

lat and long is enough, host would be any random name of your car. How are you getting the data? Is there any integration or you’re using Node-Red?

Here is my custom sensor, I am not using Node-Red. The source will response in xml format, which contains road name where the car it current is.

  - resource:
    scan_interval: 30 
    method: GET
      - name: "CurrentLocation"
        value_template: "Current in : {{ value_json['data']['place'] }}"

This is basically my step 1, although there is estimate arrival time, but its not accurate at all compare to visually look on where it is on the map.

I would still need to convert the value from the road in to lat and long by passing in the value from sensor above.

If possible, kindly provide an example of how the lat & long is enough. thx

This is how I did it

{ "dev_id": "my_accord", "host_name": "My Accord", "gps": [ {{latitude}}, {{longitude}} ]}

1 Like

thx for this, will give it a try!