Skip to content

Instantly share code, notes, and snippets.

@ckrey
Created November 15, 2023 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckrey/4d75a63625c6d460b28484979a0078a0 to your computer and use it in GitHub Desktop.
Save ckrey/4d75a63625c6d460b28484979a0078a0 to your computer and use it in GitHub Desktop.
OwnTracks Messages schema v0.1
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://owntracks.org/JsonSchema",
"title": "OwnTracks JSON Schema",
"description": "A definition of our messages",
"type": "object",
"properties": {
"_type": {
"description": "The type of the message",
"type": "string",
"enum": [ "beacon", "card", "cmd", "configuration", "location", "lwt", "steps", "transition", "waypoint", "waypoints" ]
},
"action": {
"description": " Action to be performed by the device",
"type": "string",
"enum": [ "action", "clearWaypoints", "dump", "reportLocation", "reportSteps", "setConfiguration", "setWaypoints", "waypoints" ]
},
"face": {
"description": "Base64 encoded PNG image that is displayed instead of the Tracker ID",
"type": "string",
"contentEncoding": "base64",
"contentMediaType": "image/png"
},
"lat": {
"description": "Latitude",
"type": "number"
},
"lon": {
"description": "Longitude",
"type": "number"
},
"tst": {
"description": "UNIX epoch timestamp in seconds of the location fix",
"type": "integer"
},
"name": {
"description": "Name to identify a user",
"type": "string"
}
},
"allOf": [
{
"if" : {
"properties" : {
"_type" : { "const" : "location" }
},
"required": [ "_type" ]
},
"then" : {
"required" : [ "lat", "lon", "tst" ]
}
},
{
"if" : {
"properties" : {
"_type" : { "const" : "card" }
},
"required": [ "_type" ]
},
"then" : {
"required" : [ "face", "name" ]
}
},
{
"if" : {
"properties" : {
"_type" : { "const" : "cmd" }
},
"required": [ "_type" ]
},
"then" : {
"required" : [ "action" ]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment