Particle One Tracker - Webhook Formatting

jasonshearer3 years ago

Hey team!

Working to get particle.io data into my Traccar instance via a webhook. I am successfully getting triggered messages into Traccar but need a little help with formatting if possible.

See the image here of the webhook config on the Particle side and the data that is getting into Traccar.

Config Images

Note that I am using a post via web form. Particle does support JSON.

This is the raw data from the Particle side.

{"cmd":"loc","time":1638849701,"loc":{"lck":0,"cell":57.5,"batt":99,"temp":24.5,"time":1638849701,"lat":32.342085,"lon":-90.160882,"h_acc":39},"trig":["time"],"req_id":16,"v":2,"src":["cell","wifi"]}

Any help would be appreciated!

Jason

jasonshearer3 years ago

Traccar log looks like this. Obviously the lat/lon data is embedded in the data attribute and isn't getting decoded. I just don't have the skills to parse it out :)

2021-12-06 22:11:50  INFO: [f3192e65] connected
2021-12-06 22:11:50  INFO: [f3192e65: osmand < 172.30.33.13] HEX: 504f5354202f20485454502f312e310d0a486f73743a20747261636361722e736865617265722e6c6976650d0a582d466f727761726465642d536368656d653a2068747470730d0a582d466f727761726465642d50726f746f3a2068747470730d0a582d466f727761726465642d466f723a2033352e3136382e35392e3231350d0a582d5265616c2d49503a2033352e3136382e35392e3231350d0a436f6e6e656374696f6e3a20636c6f73650d0a436f6e74656e742d4c656e6774683a203336340d0a557365722d4167656e743a205061727469636c65426f742f312e31202868747470733a2f2f646f63732e7061727469636c652e696f2f776562686f6f6b73290d0a636f6e74656e742d747970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a0d0a69643d3836373533303926646174613d253742253232636d642532322533412532326c6f6325323225324325323274696d65253232253341313633383835303330312532432532326c6f632532322533412537422532326c636b2532322533413025324325323263656c6c25323225334135372e3525324325323262617474253232253341393925324325323274656d7025323225334132342e3525324325323274696d65253232253341313633383835303330312532432532326c617425323225334133322e3334323037342532432532326c6f6e2532322533412d39302e3136303838253243253232685f61636325323225334132322537442532432532327472696725323225334125354225323274696d652532322535442532432532327265715f69642532322533413138253243253232762532322533413225324325323273726325323225334125354225323263656c6c25323225324325323277696669253232253544253744
2021-12-06 22:11:50  INFO: [f3192e65: osmand > 172.30.33.13] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2021-12-06 22:11:50  INFO: [f3192e65] id: 8675309, time: 1969-12-31 18:00:00, lat: 0.00000, lon: 0.00000, course: 0.0
Anton Tananaev3 years ago

You would probably have to implement a separate decoder for this format. Or have some external script to convert between formats.

jasonshearer3 years ago

Figured it out. Particle folks helped me with the mustache template to get the lat/lon/temp/battery info over to Traccar.

https://imgur.com/a/dVpDeFd