Using Tasker with HA RestAPI to update location

I thought I would share this (simplified):

Create a Task

  1. Get Location
  2. HTTP Post
  • Server:Port - your HA host
  • Path - /api/services/device_tracker/see?api_password=YOUR_HA_API_PASSWORD
  • Data / File - {“dev_id”:“YOUR_ID_HERE”,“battery”:"%BATT",“gps”:[%LOC],“gps_accuracy”:%LOCACC}
  • Content Type - application/json

You can then set this on events. :slight_smile:

8 Likes

Is this the name of the device i have in “known_devices.yaml”

1 Like

It was…
Only thing, the values i send: Lat, long, acc and batt, wont persist, and goes away as soon as HA refreshes.

On a restart?

No, after a few seconds, maybe owntrack, nmap och asuswrt that resets the data, should not be owntrack thou because it reports location to.

There is a Tasker mqtt Plugin, you can use that together with eg mqtt cloud

I know about the mqtt option. I am trying to keep a light footprint on the phone. :slight_smile:

I think it is nmap updating on my local network.

The status of the last device tracker that reported a location will allways overwrite the previous state. So if nmap is reporting the location every 10 seconds than the report from Tasker will only last for a maximum of 9 seconds. Try disabling nmap and see what happens.

P.s. and only now I see that this post is from 2016 lol (I just woke up, still a bit sleepy ;))

1 Like

Hi,

just a quick question: is RestAPI “safe”? I mean in the example we share our API PASSWORD in a url.

The password will be somehow hidden or exposed?

Thank you!

For those that use tasker to update your location, what type of profiles do you guys have? Trying to get an idea of how to make it work in a battery friendly way lol. How frequently do you send GPS updates?

Sorry for the might be noob question, but what is the platform needed for this one? I mean with ping platform, the hosts are the entries on ‘known devices’…

OK, just made it work with - platform: owntracks_http and a device defined in known_devices.
Thanks.