Types#
OwnTracks uses JSON format for its message payloads. The different payload types are identified by a mandatory _type element. Depending on the app platform, different payload types are supported.
_type |
iOS | Android |
|---|---|---|
beacon |
Y | N |
card |
Y | Y |
cmd |
Y | Y |
configuration |
Y | Y |
encrypted |
Y | Y |
location |
Y | Y |
lwt |
Y | Y |
request |
Y | N |
status |
Y | Y |
steps |
Y | N |
transition |
Y | Y |
waypoint |
Y | Y |
waypoints |
Y | Y |
Topics#
In MQTT mode the apps publish to:
owntracks/user/devicewith_type=locationfor location updates, and with_type=lwtowntracks/user/device/cmdwith_type=cmdfor remote commandsowntracks/user/device/eventwith_type=transitionfor enter/leave eventsowntracks/user/device/stepto report step counterowntracks/user/device/beaconfor beacon rangingowntracks/user/device/dumpfor config dumpsowntracks/user/device/statusfor status messagesowntracks/user/device/waypointwhen a geofence is created on the deviceowntracks/user/device/waypoints(plural) when exporting a list of configured waypoints from device to backend
In MQTT mode apps subscribe to:
owntracks/user/device/cmdif remote commands are enabledowntracks/+/+for seeing other user's locations, depending on broker ACLowntracks/+/+/eventfor transition messages (enter/leave)owntracks/+/+/infofor obtaining cards.
In HTTP mode the apps POST their data to a single endpoint you configure.
_type=location#
This location object describes the location of the device that reported it.
{
"_type" : "location",
elements
}
accAccuracy of the reported location in meters without unit (iOS,Android/integer/meters/optional)altAltitude measured above sea level (iOS,Android/integer/meters/optional)battDevice battery level (iOS,Android/integer/percent/optional)bsBattery Status 0=unknown, 1=unplugged, 2=charging, 3=full (iOS, Android)cogCourse over ground (iOS/integer/degree/optional)latlatitude (iOS,Android/float/degree/required)lonlongitude (iOS,Android/float/degree/required)radradius around the region when entering/leaving (iOS/integer/meters/optional)ttrigger for the location report (iOS,Android/string/optional)pping issued randomly by background task (iOS,Android)ccircular region enter/leave event (iOS,Android)Ccircular region enter/leave event for +follow regions (iOS)bbeacon region enter/leave event (iOS)rresponse to a reportLocation cmd message (iOS,Android)umanual publish requested by the user (iOS,Android)ttimer based publish in move move (iOS)vupdated bySettings/Privacy/Locations Services/System Services/Frequent Locationsmonitoring (iOS)
tidTracker ID used to display the initials of a user (iOS,Android/string/optional) required forhttpmodetstUNIX epoch timestamp in seconds of the location fix (iOS,Android/integer/epoch/required)vacvertical accuracy of thealtelement (iOS/integer/meters/optional)velvelocity (iOS,Android/integer/kmh/optional)pbarometric pressure (iOS/float/kPa/optional/extended data)poipoint of interest name (iOS/string/optional)imageBase64 encoded image associated with the poi (iOS/string/optional)imagenameName of the image associated with the poi (iOS/string/optional)connInternet connectivity status (route to host) when the message is created (iOS,Android/string/optional/extended data)wphone is connected to a WiFi connection (iOS,Android)ophone is offline (iOS,Android)mmobile data (iOS,Android)
tagname of the tag (iOS/string/optional)topic(only in HTTP payloads) contains the original publish topic (e.g.owntracks/jane/phone). (iOS,Android >= 2.4,string)inregionscontains a list of regions the device is currently in (e.g.["Home","Garage"]). Might be empty. (iOS,Android/list of strings/optional)inridscontains a list of region IDs the device is currently in (e.g.["6da9cf","3defa7"]). Might be empty. (iOS,Android/list of strings/optional)SSID, if available, is the unique name of the WLAN. (iOS,string/optional)BSSID, if available, identifies the access point. (iOS,string/optional)created_atidentifies the time at which the message is constructed (if it differs fromtst, which is the timestamp of the GPS fix) (iOS,Android/integer/epoch/optional)midentifies the monitoring mode at which the message is constructed (significant=1, move=2) (iOS/integer/optional)_idrandom identifier to be used by consumers to correlate & distinguish send/return messages (Android/string)motionactivitiescontains a list of motion states detected by iOS' motion manager (a combination ofstationary,walking,running,automotive,cycling, and/orunknown, e.g.["cycling"]). (iOS/list of strings/optional)
Notes#
- The
tstin a ping is a current timestamp, so that it doesn't look like a duplicate. - The
tiddefaults to the last two characters of the topic - A missing
telement also indicates an automatic location update - A publish of
"_type": "location"with a"b"trigger is sent when an iOS device enters or leaves a beacon in addition to a"_type": "transition": if somebody leaves and enters his home without having left the radius of detection for significant changes, a subscriber to his main topic would otherwise not get notified of any location change although beacon or circular region enter and leave transitions were generated. - The
acc,alt,cog,vac,velelements are only added if they are not zero - Some Android devices always return 0 for
altorvel - Elements marked with extended data are only added if
extendedData=trueis configured - Android devices using a VPN might not report either of SSID/BSSID which might be expected behaviour. #1888
Queclink#
OwnTracks works with a selection of trackers by Queclink, for which the protocol conversion is done via qtripp.
Queclink devices report the following additional elements in a _type=location message:
{
"_type": "location",
elements
}
ttrigger for the location report (string/optional)oCornerMMileage!Tow or fake tow or sensor without ignitionamotionless (aka park)iignition onIignition offeexternal power offEexternal power ON1Devices powered up2Battery stop charging3Battery start charging9Battery power lowhharsh behaviorsspeed alarm
odometertotal distance of the device (float/kilometers/optional)hmctotal hours of operation (float/seconds/optional)ubattvoltage of the battery (float/volts/optional)uextvoltage of the external power source (float/volts/optional)vinvehicle identification number (string/optional)imeiidentification number (string/optional)namevehicle name (string/optional)donis duration since ignition on (float/seconds/optional)doffis duration since ignition off (float/seconds/optional)aivis analog input voltage (float/volts/optional)rpmis engine rounds per minute (float/rounds per minute/optional)fconis fuel consumption (float/L per 100km/optional)flvlis fuel level (float/percent/optional)anumis number of analog inputs (integer/optional)adid-xxis id of analog input number xx (string/optional)adty-xxis type of analog input number xx (string/optional)adda-xxis data of analog input number xx (string/optional)temp_c-xxis temperature of analog input number xx (float/celsius/optional)canis can data (string/optional)din1is status of digital input 1 (boolean/optional)din2is status of digital input 2 (boolean/optional)dout1is status of digital output 1 (boolean/optional)dout2is status of digital output 2 (boolean/optional)ignis status of ignition (boolean/optional)motionis motion status (boolean/optional)towis status of tow sensor (boolean/optional)fakeis status of fake tow sensor (boolean/optional)sensis status of motion sensor (boolean/optional)sentis epoch when message was sent (integer/epoch/optional)mccis mobile country code (integer/optional)mncis mobile network code (integer/optional)lacis location area code (string/optional)cidis cell id (string/optional)nmdsis non movement detection status (boolean/optional)ritqueclink record id and type (integer/optional)rtyqueclink record type (integer/optional)ridqueclink record id (integer/optional)mstqueclink motion state (integer/optional)countis counter of message (string/optional)raw_lineraw data (string/optional)counternumber of ignored positions (integer/optional)ignoredindicates counter positions have been ignored (boolean/optional)
Notes#
- The device can be configured to produce or not produce fields marked as optional
_type=lwt#
A last will and testament is published automatically by the MQTT broker when it loses contact with the app. This typically looks like this:
{
"_type":"lwt",
elements
}
tstUNIX epoch timestamp at which the app first connected (iOS,Android/integer/epoch/required)
_type=waypoint#
Waypoints / regions denote specific geographical regions that you want to keep track of. You define a region in the OwnTracks app, and OwnTracks publishes this waypoint to the topic branch ../waypoint (singular). OwnTracks also monitors these waypoints and will publish {_type: "transition", ...} message when entering or leaving the region. A waypoint may also define a BLE Beacon instead of a geographical region.
{
"_type" : "waypoint",
elements
}
descName of the waypoint that is included in the sent transition message, copied into thelocationmessageinregionsarray when a current position is within a region. (iOS,Android,string/required)latLatitude (iOS,Android/float/degree/optional)lonLongitude (iOS,Android/float/degree/optional)radRadius around the latitude and longitude coordinates (iOS,Android/integer/meters/optional)tstTimestamp of creation of region, copied into thewtstelement of the transition message (iOS,Android/integer/epoch/required)uuidUUID of the BLE Beacon (iOS/string/optional)majorMajor number of the BLE Beacon (iOS/integer/optional)minorMinor number of the BLE Beacon_(iOS/integer/optional)_ridregion ID, created automatically, copied into thelocationpayloadinridsarray (iOS/string)_
Notes#
- In iOS version >= 9.1.0 the last three elements (uuid, major, and minor) are used to configure Beacon waypoints instead of encoding these values into the
descelement. - If
lat,lonandradelements are present, transition messages are sent when entering and leaving the geographical region - If
uuid,major,minorelements are present, BLE becons with that specifications are monitored - Beacons and Geographical regions can be defined together
- Waypoint messages are published non-retained because the second waypoint would overwrite the first: a client would only get the last one which makes no sense. Your application will typically store waypoints to some kind of persistent storage.
- Waypoints are sent to the broker and transition messages contain a
descandeventelement.
_type=transition#
A transition message is sent, when entering or leaving a previously configured geographical region or BLE Beacon. In addition to the coordinates where the event fired, the message contains the timestamp of the waypoint creation as well as the event that triggered the transition message with its description. MQTT transition messages are published non retained.
{
"_type": "transition",
elements
}
wtstTimestamp of waypoint creation (iOS,Android/integer/epoch/required)latLatitude at which the event occured (iOS,Android/float/degree/optional)lonLongitue at which the event occured (iOS,Android/float/degree/optional)tstTimestamp at which the event occured (iOS,Android/integer/epoch/required)accAccuracy of the geographical coordinates (iOS,Android/int/meters/required)tidTracker ID of the (iOS/string/none/optional) required in http mode.eventEvent that triggered the transition (iOS,Android/string/required)enterThe device entered the defined geographical region or BLE Beacon range (iOS)leaveThe device left the defined geographical region or BLE Beacon range (iOS)
descName of the waypoint (iOS,Android/string/optional)tTrigger of the event (iOS,Android/string/optional)cCircular geographical region (iOS, Android)bBLE Beacon (iOS)lLocation update (Android)
ridRegion ID (iOS/Android, after January 2021)
_type=configuration#
The device configuration can be imported and exported as JSON. The exported configuration can contain an array of waypoints that are defined on the device. If enabled, apps also accept remote configuration messages.
{
"_type": "configuration",
elements
}
adapttime in minutes of non-movement before switching from move to significant mode. 0 (zero) means disabled. Defaults to 0 (zero) (iOS/integer/minutes/optional)allowRemoteLocationRespond to reportLocation cmd message (iOS/boolean)allowinvalidcertsdisable TLS certificate checks insecure (iOS/boolean)authUseusernameandpasswordfor endpoint authentication (iOS,Android/boolean)autostartOnBootAutostart the app on device boot (Android/boolean)cleanSessionMQTT endpoint clean session (iOS,Android/boolean)clientIdclient id to use for MQTT connect. Defaults to "user deviceId" (iOS,Android/string)clientpkcsName of the client pkcs12 file (iOS/string)cmdRespond to cmd messages (iOS,Android/boolean)connectionTimeoutSeconds(default 30) TCP timeout for establishing a connection to the MQTT / HTTP broker, (Android/int)daysNumber of days to keep locations stored locally. 0 means no local keeping of locations. A negative number indicates to use thepositionsvalue. Defaults to -1 for backward compatibility. (iOS/integer/days)debugLog(default false) whether or not debug logs should be shown in the log viewer / exporter activity (Android/bool)deviceIdid of the device used forpubTopicBaseandclientIdconstruction. Defaults to the os name of the device (iOS,Android/string)downgradebattery level below which to downgrade monitoring from move mode (iOS/integer/percent/optional)encryptionKeythe secret key used for payload encryption (iOS,Android/string)extendedDataAdd extended data attributes to location messages (iOS,Android/boolean)hostMQTT endpoint host (iOS,Android/string)httpHeadersextra HTTP headers:field names and field content are separated by a colon (:), multiple fields by a backslash-n (\n) \<field-name>:\<field-content>\n\<field-name>:\<field-content>... (iOS only/string)ignoreInaccurateLocationsLocation accuracy below which reports are supressed. 0 means no locations are suppressed. (iOS,Android/integer/meters)ignoreStaleLocationsNumber of days after which location updates are assumed stale. Locations sent by friends older than the number of days specified here will not be shown on map or in friends list. Defaults to 0, which means stale locations are not filtered. (iOS,Android/integer/days)keepaliveMQTT endpoint keepalive (iOS,Android/integer/seconds)locatorDisplacementmaximum distance between location source updates (iOS,Android/integer/meters)locatorIntervalmaximum interval between location source updates (iOS,Android/integer/seconds)locatorPrioritysource/power setting for location updates (Android/integer)0NO_POWER / best accuracy possible with zero additional power consumption (Android)1LOW_POWER / city level accuracy (Android)2BALANCED_POWER / block level accuracy based on Wifi/Cell (Android)3HIGH_POWER / most accurate accuracy based on GPS (Android)
lockedLocks settings screen on device for editing (iOS/boolean)maxHistoryNumber of notifications to store historically. Zero (0) means no notifications are stored and history tab is hidden. Defaults to zero. (iOS/integer)modeEndpoint protocol mode (iOS,Android/integer)0MQTT (iOS, Android)3HTTP (iOS, Android)
monitoringLocation reporting mode (iOS,Android/integer)-1Quiet0Manual1Significant2Move
mqttProtocolLevelMQTT broker protocol level (iOS,Android/integer)3MQTT 3 (default)4MQTT 3.1.15MQTT 5 (iOS only)
notificationLocationShow last reported location in ongoing notification (Android/boolean)opencageApiKeyAPI key for alternate Geocoding provider. See OpenCage for details. (Android/string)osmTemplateURL template for alternate tile provider. Defaults tohttps://tile.openstreetmap.org/{z}/{x}/{y}.png. (iOS/string)osmCopyrightAttribution text shown with OSM map. Defaults to(c) OpenStreetMap contributors. (iOS/string)passphrasePassphrase of the client pkcs12 file (iOS/string)passwordEndpoint password (iOS,Android/string)pegLocatorFastestIntervalToInterval(default false) - if true, requests that that the device provide locations no faster than the specified interval. Location providers often use the requested interval as a "at least every" setting, and may return locations more frequencly. Some people wanted the behaviour where it also meant "no more frequently than", so this setting lets them specify this (Android/bool)pingInterval in which location messages of witht:pare reported (Android/integer)portMQTT endpoint port (iOS,Android/integer)positionsNumber of locations to keep for friends and own device and display (iOS/integer)pubTopicBaseMQTT topic base to which the app publishes;%uis replaced by the user name,%dby device (iOS,Android/string)pubRetainMQTT retain flag for reported messages (iOS,Android/boolean)pubQosMQTT QoS level for reported messages (iOS,Android/integer)rangingBeacon ranging (iOS/boolean)remoteConfigurationAllow remote configuration by sending asetConfigurationcmd message (Android/boolean)subsubscribe tosubTopicvia MQTT (iOS,Android/boolean)subTopicA whitespace separated list of MQTT topics to which the app subscribes ifsubis true (defaults see topics) (iOS,Android/string)subQos(iOS,Android/boolean)tidTwo digit Tracker ID used to display short name and default face of a user (iOS,Android/string)tlsMQTT endpoint TLS connection (iOS,Android/boolean)tlsClientCrtPasswordPassphrase of the client pkcs12 file (Android/string)urlHTTP endpoint URL to which messages are POSTed (iOS,Android/string)usernameEndpoint username (iOS,Android/string)wsuse MQTT over Websocket, defaultfalse(iOS,Android/boolean)waypointsArray of waypoint messages (iOS,Android/array)
Notes#
- When importing a configuration message, all contained values are imported for the currently active mode. If the message also contains a
modeelement, the mode is changed first and all remaining elements are imported for the new mode. - In MQTT mode the server will consider the client as dead if it the keepalive interval plus 50% passed without receiving any MQTT packet from the client (e.g. after 90 sec if
keepalivewas 60). Afterwards, anlwtmessage will be send.
_type=status#
The device status contains information about the settings on the device which are not configured in the app.
{
"_type": "status",
"iOS": <iOS specific elements>,
"android": <android specific elements>
<other elements>
}
- iOS specific elements
altimeterAuthorizationStatusused for steps (iOS/string) as defined in CMAuthorizationStatusaltimeterIsRelativeAltitudeAvailableused for steps (iOS/boolean) as defined in isRelativeAltitudeAvailablebackgroundRefreshStatus(iOS/boolean) as defined in UIBackgroundRefreshStatusAvailabledeviceIdentifierForVendorused for default DeviceID (iOS/string) as defined in identifierForVendordeviceModel(iOS/string) as defined in modeldeviceSystemName(iOS/string) as defined in systemNamedeviceSystemVersion(iOS/string) as defined in systemVersiondeviceUserInterfaceIdiom(iOS/string) as defined in userInterfaceIdiomlocalethe current locale on the device (iOS/string) as defined in localeIdentifierlocaleUsesMetricSystem(iOS/boolean) as defined in usesMetricSystemlocationManagerAuthorizationStatusused for all locations (iOS/string) as defined in "CLAuthorizationStatus"motionActivityManagerAuthorizationStatusused for motionactivities (iOS/string) as defined in motionActivityManagerAuthorizationStatusmotionActivityManagerIsActivityAvailableused for motionactivities (iOS/boolean) as defined in motionActivityManagerIsActivityAvailablepedometerIsDistanceAvailable(iOS/boolean) as defined in isDistanceAvailablepedometerIsFloorCountingAvailable(iOS/boolean) as defined in isFloorCountingAvailablepedometerIsStepCountingAvailable(iOS/boolean) as defined in isStepCountingAvailableversionversion of the OwnTracks app (iOS/string)
- android specific elements
hibapp can hibernate if not used (Android/integer)boapp is configured with battery optimizations (Android/integer)locapp location permissions (Android/integer)psphone power save mode (Android/integer)wifiwifi is on/off (Android/integer)
- other elements
_idrandom identifier to be used by consumers to correlate & distinguish send/return messages (Android/string)
_type=beacon#
These messages are published when beacon ranging (iOS only) is enabled. Be advised that beacon ranging publishes a lot of messages and has a strong impact on battery life.
{
"_type":"beacon",
elements
}
descname of the seen beacon (iOS/String)uuidUUID of the seen beacon (iOS/String)majorMajor number of the seen beacon (iOS/integer/epoch)minorMinor number of the seen beacon (iOS/integer/epoch)tstTimestamp at which the beacon was seen (iOS/integer/epoch)accAccuracy of the proximity value (iOS/integer/meters)rssiReceived signal strength of the beacon (iOS/integer/decibel)proxRelative distance to the beacon (iOS/integer)0Proximity of the beacon could not be determined1Beacon is in the immediate vicinity2Beacon is relatively close to the user3Beacon is far away
Notes#
- The theoretical relationship between RSSI and distance is
RSSI[dbm] = −(10n log10(d) − A)where d is the distance and A is the offset which is the measured RSSI one meter point away from the beacon.
_type=cmd#
{"_type":"cmd", "action":"reportLocation"}
{"_type":"cmd", "action":"reportSteps"}
{"_type":"cmd", "action":"dump"}
{"_type":"cmd", "action":"status"}
{"_type":"cmd", "action":"waypoints"}
{"_type":"cmd", "action":"clearWaypoints"}
{"_type":"cmd", "action":"setConfiguration", "configuration":{"_type":"configuration",...}
{"_type":"cmd", "action":"setWaypoints", "waypoints":{"_type":"waypoints","waypoints":[...]}
actionaction to be performed by the device (iOS,Android/string)dumpTriggers the publish of aconfigurationmessage (iOS)statusTriggers the publish of astatusmessage to../status(iOS)reportStepsTriggers the report of astepsmessages_(iOS)_fromTimestamp (iOS/epoch/optional)toTimestamp (iOS/epoch/optional)
reportLocationTriggers the publish of alocationmessages (iOS,Android) Don‘t expect device to be online. Send with QoS>0. Device will receive and repond when activated next time.clearWaypointsdeletes all waypoints/regions (iOS)setWaypointsImports (merge) and activates new waypoints (iOS,Android)waypointsArray ofwaypointmessages to import (iOS,Android/array/required)
setConfigurationImports and activates new configuration values (iOS,Android)configurationConfiguration message to import (iOS,Android/required)
waypointsTriggers publish of awaypointsmessage (iOS,Android)
Notes#
- On iOS, the array of waypoints to the
setWaypointscommand allows updates / removal; the key of the waypoint is its name (desc). If you specify an invalidlatorlon(invalid means out of range number value e.g.-1000000, a string like"foo"will result in a0in app) the waypoint is deleted. - On Android there's a primary key which isn't surfaced to the API, and
tstis a uniquely-constrained value which effectively acts like a key.
_type=steps#
{
"_type":"steps",
elements
}
tstTimestamp of the request (iOS/integer/epoch)stepsSteps walked with the device in the specfied time period (iOS/integer/steps)fromEffective start of time period (iOS/integer/epoch)toEffective end of time period (iOS/integer/epoch)
Notes#
stepsis -1 if device does not support step counting or specified time period is invalid
_type=card#
Apps read Card to display a name and icon for a user.
{
"_type": "card",
elements
}
tidTracker ID to associate the card with (iOS,Android/string/required)nameName to identify a user (iOS,Android/string/optional)faceBase64 encoded PNG image that is displayed instead of the Tracker ID (iOS,Android/string/optional)
_type=waypoints#
The app can export a list of configured waypoints to the endpoint ../waypoints (plural).
{
"_type": "waypoints",
elements
}
_creatorIdentification of what created the array. Ignored by the apps (iOS,Android/string/optional)waypointsArray ofwaypointmessages (iOS,Android/array/required)
_type=encrypted#
Apps can optionally encrypt outgoing messages with a shared symmetric key. The encrypted message is contained in the dataelement.
For security reasons, the encryption key is not exported with configuration messages and cannot be imported.
{
"_type": "encrypted",
elements
}
dataEncrypted and Base64 encoded original JSON message (iOS,Android/string/required)
_type=request#
Apps can request the creation of tours which elicit a cmd response from the Recorder. See tours for the details.
{
"_type": "request",
"request": "tour",
"tour": {
...
}
}