Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document programmatic example for sending telemetry data from thin-edge #1050

Open
albinsuresh opened this issue Apr 4, 2022 · 2 comments
Open
Labels
documentation Improvements or additions to documentation improvement User value theme:telemetry Theme: Telemetry data

Comments

@albinsuresh
Copy link
Contributor

Is your documentation request related to a problem? Please describe.

Our current documentation only contains examples using the tedge mqtt commadline tool to send data from thin-edge. Having a programmatic example written in C/C++ would be helpful for many developers.

Describe the improvement you'd like

A minimal programatic example that showcases how to connect to the local broker and send a simple measurement like temperature measurement using Thin Edge JSON in C/C++. This example should be published in our public documentation, linked from the existing doc that showcases the tedge mqtt pub based samples.

Adding an additional Python example would also help. We can expand this set in future with Rust, Go and Java examples as well, if there's interest.

@rina23q
Copy link
Member

rina23q commented Apr 4, 2022

I have a Python example to publish JSON. You might be able to use this.

import json
import paho.mqtt.publish as publish

temperature = 10.0
humidity = 45.0

raw = {
    "temperature": temperature,
    "humidity": humidity
}
data_json = json.dumps(raw)

publish.single("tedge/measurements", data_json, hostname="localhost")

@rina23q rina23q added documentation Improvements or additions to documentation willwork labels Apr 12, 2022
@rina23q
Copy link
Member

rina23q commented Apr 12, 2022

AC:

Extend the document

Needs to be considered (out of scope of this issue)

  • MQTT explanation
  • We use those examples in our test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation improvement User value theme:telemetry Theme: Telemetry data
Projects
None yet
Development

No branches or pull requests

3 participants