Brand New to HA -Trying to use rest api-struggling

First time here. Coming from Homeseer and one add-on I loved was a thing called phlocation, mostly because it would allow Followmee app on my phones to provide rock solid tracking updates. No reliance on icloud or HA phone app which was tried but not granular enough with updates. ALAS. Here4 is the API string I can query from followmee, the data it will return. Trying to get this into HA to ultimately get into a mapping card.

API first
https://www.followmee.com/api/tracks.aspx?key=xxxxxxxxxxxxxxxxx&username=xxxxxx&output=json&function=currentfordevice&deviceid=xxxxxxx

That will return the following json:

  "Data": [
    {
      "DeviceName": "iphone16",
      "DeviceID": "12345677",
      "Date": "2025-01-02T13:13:39-05:00",
      "Latitude": 35.22034,
      "Longitude": -83.18725,
      "Type": "GPS",
      "Speed(mph)": null,
      "Speed(km/h)": null,
      "Direction": null,
      "Altitude(ft)": 1108,
      "Altitude(m)": 338,
      "Accuracy": 55,
      "Battery": "50%"
    }
  ]
}

This is as far as I have gotten in configuration .yaml and I am certain it is wrong.
Obviously, I want to consume the data from followmee and have it work in a map card so there may need to be data parsing/changing

sensor:
   - platform: rest
    resource: https://www.followmee.com/api/tracks.aspx?key=xxxxxxxxxxx&username=xxxxxxx&output=json&function=currentfordevice&deviceid=12345677
    name: "DeviceNameLatitude"
    value_template: "{{ value_json.Latitude }}"
    scan_interval: 120

I was only trying to get one value in during testing. It created the sensor but no data on an entity card.

You can use this site to find the path to your data: https://jsonpathfinder.com/

Paste the full data retuned on the left (you missed a { in what you supplied above), drill down on the right and replace x at the top of the right hand side with value_json.

value_template: "{{ value_json.Data[0].Latitude }}"

Wow! That was fast and that worked. Now I will try to figure out how to get this into an map card. I didn’t ask for those hints. Want to try on my own first and come back with questions if I have issues.

Thank you Tom!!

I do see I need to switch to rest: to take in multiple values with one call.

1 Like

Usually I would say yes that is the way to go. However for a tracker you want the lat & long as attributes, which you can do with either the integration or sensor platform.

e.g.

However something else to consider is that unfortunately there is no template or restful device tracker. There are a couple of work-arounds though:

Use an automation to publish your sensor data to an mqtt broker and use this:

Or use the known_devices file: Create a device tracker from sensor template (GPS coordinates from REST API) - #3 by rompca7

So I have made some progress, not sure I am going int he right direction. I read up on your two ideas for getting to use this as tracking data. Honestly, reading this stuff gets you shooting down rabbit holes and get lost in the confusion. However, I though I would post what I have changed so far and see if I am going in the right direction and what to do next with what I have for data at the moment.

So my Congiguration YAML now looks like this.

rest:
    resource: https://www.followmee.com/api/tracks.aspx?key=xxxxxxxxxx&username=xxxxxxx&output=json&function=currentfordevice&deviceid=12367877
    sensor:
      - name: "Richard_JSON_Info"
        unique_id: 2b97d
        value_template: "{{ value_json.Data[0].phoneinfo }}"
        json_attributes_path:  "$.Data[0]."
        json_attributes:
          - "DeviceName"
          - "DeviceId"
          - "Date"
          - "Latitude"
          - "Longitude"
          - "Type"
          - "Speed(mph)"
          - "Speed(km/h)"
          - "Direction"
          - "Altitude(ft)"
          - "Altitude(m)"
          - "Accuracy"
          - "Battery"
    scan_interval: 120

that produces an “Entities” entry when I look for it in entities.

Sorry for the CSS coloring…

Is this on the right track? Where would I go from here? Any pointers assitance is appreciated.
-Richard aka NAcman

@tom_l

Yes you should be :see_no_evil:

Yes you have the information in Home Assistant.

Either of the two options I posted above. Neither are great. Known devices is old and not really wanted by the devs (though it does still work). MQTT is a lot of overhead. We really need a template device tracker (or restful device tracker).

Ok, I have a working map!!! Tracking and updating. I went the known_devices route.
Thak you for your help!

Now I have a question, maybe not the right place to ask… How to I stuff more information into the points that are ploted. Currently, it only shows "Richard’s Location and a Date & Time. How do I get the other stuff the rest api is pulling in? I have all the entities built, and they are recording it, just don’t know how to add their data to the clickable plot point. Is that possible?

Here is what I get now

In homeseer, below is what I was used to… What is really interesting in that plugin (PHlocation) he must be using the google API “Snap to Road” interpolation because all the points on my old system were always on a road.
This is the only integration that was way better in HS3/HS4.