Freika / dawarich

Self-hosted alternative to Google Location History (Google Maps Timeline)
https://dawarich.app
GNU Affero General Public License v3.0
2.19k stars 51 forks source link

Arugments Location Format #104

Closed gTamatea closed 4 months ago

gTamatea commented 4 months ago

Describe the bug It's not really a bug but I would like to know the precise format that dawarich is waitng. I just get "ActiveRecord::RecordInvalid: Validation failed: Latitude can't be blank, Longitude can't be blank"

Version 8.1

To Reproduce See the error in sidekiq when receiving a location update

Expected behavior No error when Dawarich receive a location update

Screenshots N/A

Logs Owntracks::PointCreatingJob

{"{\"_type\":\"location\",\"acc\":48,\"alt\":86,\"batt\":\"41\",\"conn\":\"w\",\"lat\":40.881283,\"lon\":1.3575878,\"tid\":\"phone\",\"tst\":1020106901,\"vac\":2,\"vel\":0,\"cog\":170}"=>nil, "api_key"=>"xxx redacted xxx", "controller"=>"api/v1/owntracks/points", "action"=>"create"}, 1

ActiveRecord::RecordInvalid: Validation failed: Latitude can't be blank, Longitude can't be blank

Additional context Thanks for you help

Freika commented 4 months ago

Hi @gTamatea! Can I ask you to include more logs from containers surrounding the error? Thank you!

gTamatea commented 4 months ago

Hi @gTamatea! Can I ask you to include more logs from containers surrounding the error? Thank you!

Hello thanks for your answer. In fact I was using json message and not http as I misread my configuration. Everything seems ok now :)

Freika commented 4 months ago

Closing this then!

tigattack commented 4 months ago

Hi @gTamatea! Can I ask you to include more logs from containers surrounding the error? Thank you!

Hello thanks for your answer. In fact I was using json message and not http as I misread my configuration. Everything seems ok now :)

Could you elaborate on this? I'm seeing the same error and not sure what's wrong as I'm POSTing my location updates to dawarich in the same way as I do to my owntracks recorder.

gTamatea commented 4 months ago

Hello, I'm using homeassistant with node-red to post a message to dawarich.

BEFORE `// Construct msg.payload as a JavaScript object msg.payload = { _type: 'location', acc: gps_accuracy, alt: altitude, batt: battery_level, conn: connection_type, lat: latitude, lon: longitude, tid: tracker_id, tst: timestamp, vac: vertical_accuracy, vel: velocity, cog: course, };

// Convert msg.payload to minified JSON msg.payload = JSON.stringify(msg.payload);`

AFTER (disable json) `// Construct msg.payload as a JavaScript object msg.payload = { _type: 'location', acc: gps_accuracy, alt: altitude, batt: battery_level, conn: connection_type, lat: latitude, lon: longitude, tid: tracker_id, tst: timestamp, vac: vertical_accuracy, vel: velocity, cog: course, };

// Convert msg.payload to minified JSON //msg.payload = JSON.stringify(msg.payload);`

tigattack commented 4 months ago

Handy, I'm using it the same way. Omitting JSON.stringify solved it for me too, thanks!