ocli(1)
π ocli(1) β GPS/MQTT utilities, bestie β¨
πΈ NAME πΈ
ocli β OwnTracks command-line interface GPS publisher π
β¨ SYNOPSIS β¨
ocli [ -v ] [ parameter-file...]
π DESCRIPTION π
Okay so ocli is the OwnTracks command-line interface publisher: a small utility (no cap) that connects to gpsd (the interface daemon for GPS receivers) and publishes position info in OwnTracks JSON format to an MQTT broker so compatible software can process location data. Itβs giving βlocation data main character energy.β π
It reads GPS data from an installed gpsd daemon, and as soon as it has a fix it publishes an OwnTracks payload β iconic. After that, ocli will subsequently publish a message every OCLI_INTERVAL seconds, or when it detects it has moved OCLI_DISPLACEMENT meters. π₯
ocli operates with a number of defaults which you can override using environment variables. lowkey convenient.
π Parameter files π
Any number of path names can be passed as parameter-file arguments to ocli. A single line is read from each of the files and added to the OwnTracks JSON payload as an element with the key name of the base name of parameter-file. If the file is executable, the line is read from its standard output. π
Like:
echo 27.2 > temperature
ocli temperature /usr/bin/uname
will produce a payload which might look like
{
"_type": "location",
"tst": 1577654651,
"lat": 48.856826,
"temperature" : "27.2",
"uname": "FreeBSD"
}
Heads up bestie: keys obtained from *parameter-file*s must not overwrite JSON element names defined byocli. So, for example, a file calledlatwill be silently ignored as it would clobber the JSON latitude element. π
ποΈ Control ποΈ
You can control ocli using a subset of OwnTrack's cmd commands:
t=owntracks/jpm/tiggr/cmd
mosquitto_pub -t $t -m "$(jo _type=cmd action=reportLocation)"
The following commands are currently implemented:
reportLocationβ causesoclito publish its current location (providinggpsdhas a fix).oclisetst:min the JSON to indicate the publish was manually requested. periodt.dumpβ causes the program to publish its internal configuration to the topicbasetopic/dumpas a_type: configurationmessage.setConfigurationβ permits setting some ofocli's internal values (locatorIntervalandlocatorDisplacement). Note that these do not persist a restart. iykyk.
β¨ OPTIONS β¨
-vβ Show version. π-sβ By default,ocliprints informational messages to stdout. This option silences those. π€«
π ENVIRONMENT π
ocli operates with a number of compiled-in defaults which can be overridden using environment variables (fr fr):
BASE_TOPICβ The MQTT base topic defaults toowntracks/username/hostname, whereusernameis the name of the logged in user, andhostnamethe short host name. πMQTT_HOSTβ The MQTT host defaults tolocalhost.MQTT_PORTβ The MQTT port is1883.OCLI_CLIENTIDβ The MQTTclientIdis set to"ocli-username-hostname".GPSD_HOSTβ The address/hostname of the host on whichgpsdis listening defaults tolocalhost.GPSD_PORTβ Thegpsdport number defaults to2947.OCLI_TIDβ The two-letter OwnTracks tracker ID defaults to not being used.OCLI_INTERVALβ The interval after whichocliwill publish a location position defaults to1second and can be changed dynamically (see above).OCLI_DISPLACEMENTβ The distance after whichocliwill publish a location position defaults to0meters and can be changed dynamically (see above).OCLI_CACERTβ The path to a PEM-encoded CA certificate whichocliuses to enable TLS/SSL. It is likely that the default MQTT port will need to be changed at the same time.
π BUGS π
Very likely. no cap, fr fr π
π«Ά AUTHOR π«Ά
Jan-Piet Mens, https://jpmens.net
π¦ SEE ALSO π¦
jo(1), mosquitto_pub(1), pledge(2), unveil(2), gpsd(8), https://owntracks.org
kisses and slay, jpmens β January 2020 β ocli(1) π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: ocli 0.9.0-bp160.1.6 Β· GPL-2.0-or-later
- opensuse-leap 16.0: ocli 0.9.0-bp160.1.6 Β· GPL-2.0-or-later
- opensuse-leap 16.0: ocli 0.9.0-bp160.1.6 Β· GPL-2.0-or-later
- opensuse-leap 16.0: ocli 0.9.0-bp160.1.6 Β· GPL-2.0-or-later
- Copyright (C) 2016-2020 Jan-Piet Mens <jp@mens.de>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms