android icon indicating copy to clipboard operation
android copied to clipboard

Setting the device name/id for Traccar

Open newts opened this issue 4 years ago • 2 comments
trafficstars

(log below)

I am new to using this and Traccar (and love it!) but I was having a lot of trouble figuring out the settings between them and to make it worse I don't know wtf OT should be sending. If there's something in ID it sends it but only allows 2 characters to be entered. Otherwise it seems to take the last 2 from the Device ID that I entered (monkey). I had this trouble yesterday and somehow got it use the entire Device ID which matches Identifier on Traccar and it works.

Maybe it's a bug in traccar to use the X-limit in the HTTP header instead of the JSON payload but for usability it seems like it is a bug and the Device ID field should be sent as the tid field. Or allow longer Tracker ID field as Traccar seems to like long names here.

Owntracks 2.3.0 (23024) on Ulefone Android 10 and on whatever the latest emulator with jetbrains is.

image

here is the Traccar log:

POST / HTTP/1.1
User-Agent: Owntracks-Android/23024
Authorization: Basic xxx
X-Limit-U: jv
X-Limit-D: monkey
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Content-Length: 165
Host: xxxx:5144
Connection: Keep-Alive
Accept-Encoding: gzip

{"_type":"location","acc":3,"alt":5,"batt":100,"bs":0,"conn":"m","created_at":1626479744,"lat":yyy,"lon":xxx,"tid":"ey","tst":1626479744,"vac":0,"vel":0}

newts avatar Jul 17 '21 00:07 newts

(I have edited your comment to remove lat and lon (for privacy reasons), and I've removed the base64 encoded credentials in your HTTP POST -- you might want to change those.)

Our Traccar protocol decoder does indeed use the Tracker ID (TID) as you've already determined, unless the HTTP payload contains a topic element in the JSON which, I think we don't yet add by default. If only the former is present then your Traccar device's uniqueId will have to match the tid value ("tid":"ey"), in the case of the latter, the topic element in the JSON.

I hope to be able to address our documentation soon and give it lots of love, and I will try to address this likewise.

Thank you for your comments.

jpmens avatar Jul 17 '21 10:07 jpmens

Thank you. This is a great app I hope to use and maybe contribute to.

I was already using your suggestion as a work around for testing. And thanks for removing the privacy details, I scrubbed the server name but the left the rest. The location is a random one off the emulator and account is temporary test one (always mount a scratch monkey).

jv

newts avatar Jul 17 '21 12:07 newts