Skip to content

Instantly share code, notes, and snippets.

@ArrEssJay
Created April 14, 2022 06:24
Show Gist options
  • Save ArrEssJay/95cb07c6f11335a2f5613e64f0930de1 to your computer and use it in GitHub Desktop.
Save ArrEssJay/95cb07c6f11335a2f5613e64f0930de1 to your computer and use it in GitHub Desktop.
UBX GNSS data -> telegraf using pyubx2 outputting JSON
# The lambda function coerces pyubx2 into outputting JSON. Requires importing the `jsons` library
[[inputs.execd]]
command = ["gnssdump", \
"port=/dev/ttyACM0", \
"baudrate=921600",
"protfilter=2", \
"verbosity=0", \
"ubxhandler=lambda msg: print(jsons.dumps((lambda msg: {key:value for (key,value) in dict(msg.__dict__, **{'msg':msg.identity}).items() if not key.startswith('_') } )(msg)))", \
"msgfilter=NAV-PVT"]
data_format = "json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment