android
android copied to clipboard
Issue creating waypoints from JSON file
Hi, (Newbie here - can't yet work out how to tag this as a question, as I strongly suspect user error, not a bug!)
I'm trying to mass create regions/waypoints on the family's phones using a json file. I've not had much success - I get errors back from Owntracks on file open. To go back to basics, I've taken the example from the instructions on this page: https://owntracks.org/booklet/features/remoteconfig/ and made a file with extension .otrc out of this JSON:
{
"_type": "cmd",
"action": "setWaypoints",
"waypoints": {
"waypoints": [
{
"desc": "Some place",
"rad": 8867,
"lon": 10.428771973,
"lat": 46.935260881,
"tst": 1437552714,
"_type": "waypoint"
}
],
"_type": "waypoints"
}
}
I've then emailed that to myself and opened it on my phone. (I've associated the otrc extn with the OwnTracks app) The OwnTracks app returns the error message "Import failed: Message is not a valid configuration message" I have just spotted that the instructions talk about "Publishing the above payload to an OwnTracks iOS device" - is this really only an iOS feature? I feel it's more likely I've done something wrong!
Thanks for any help!
James
- App build number: 2.4.9
- Android version: 12
- Device: Google Pixel 6 Pro
- Installation source: Play
The JSON you have there is indeed not a configuration file (it isn't OTRC material) but rather a payload you might send via MQTT to your device for setting waypoints remotely.
If you want to import waypoints via configuration you will need at OTRW file which you can also produce from your device by exporting an existing waypoint. The syntax is also shown on https://owntracks.org/booklet/features/beacons/
Thanks for the guidance Jan-Piet - although the syntax on the page you referenced also fails, by looking at my own config I think I've arrived a syntax that works.... I used this, saved as .otrw:
{
"_type": "configuration",
"waypoints":[
{
"desc": "Friend",
"rad": 12,
"lon": -3.18297,
"lat": 52.8381,
"tst": 12341234001,
"_type": "waypoint"
}
],
"_type" : "waypoints"
}
So I'm very happy - I've got there. However, I reckon the booklet is incorrect in two places - is there anywhere I should post suggested corrections? Thanks so much! James
However, I reckon the booklet is incorrect in two places - is there anywhere I should post suggested corrections?
Very gladly, if you wish to provide a pull-request at https://github.com/owntracks/booklet we'd appreciate that very much!
@jimxbob note you have two _type
elements in the JSON, which we don't support. Your JSON should written as:
{
"_type": "waypoints",
"waypoints": [
{
"desc": "Friend",
"rad": 12,
"lon": -3.18297,
"lat": 52.8381,
"tst": 12341234001,
"_type": "waypoint"
}
]
}
@jpmens I've done some further testing, including on family members with iPhones I'm on the edges of my skills here, and haven't used JSON much.... I'd agree that what you have written looks better, and indeed is the format needed for iPhones, but it does not work on Android, whereas putting it within a configuration type does work on Android - I get "Import failed: Message is not a valid configuration message" Both were saved with .OTRW extension
This appears to be a bug, @jimxbob; thanks for reporting it, and I've opened an appropriate ticket.
I have fixed this (just checked on main branch), I just can't remember when I fixed this. Closing.