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

[TerkinTelemetry] Renovations to improve the library interface, and to make things work #80

Merged
merged 1 commit into from Jun 6, 2023

Conversation

amotl
Copy link
Member

@amotl amotl commented Jun 3, 2023

About

In order to do the right thing, this patch renovates the TerkinTelemetry library a bit. It also adds a README, and runnable example programs, aiming to make it a first citizen of the library code provided by this repository, alongside the BERadio C++ and TerkinData C++ libraries.

Synopsis

Transmit sensor measurement readings from Arduino and libc environments, for humans. 1

telemetry->transmit(measurement);

Details

The library is still in its infancy, being very much work in progress, but at least this patch is another iteration which actually makes a few things work, where they did not work beforehand. While working on this iteration, I've adjusted a few class names, and removed one layer of indirection.

Now, there are three classes you will use to configure a telemetry client instance, each with a specific subset of connectivity parameters. This design aims to make the library as modular as intended, without overcomplicating it.

  • ChannelAddress: You will use it to define the data acquisition channel your device will submit data to. It reflects the venerable quadruple hierarchic addressing scheme we are using for connecting, addressing, and mapping individual sensor node devices in a wide-area scenario.
  • XyzTransmitter: You can select one of the available transmitter components, in order to define which kind of outbound transport you are intending to use. There are different kinds of transmitter components included into TerkinTelemetry, but it is possible to bring your own.
  • TelemetryClient: The telemetry client instance your code will interact with, in order to actually submit measurement/metric values, after reading your sensors.

I am not sure this will turn out well, but it is worth to explore. More details are available on our discussion forum at 2.

Usage

Setup

// The address of the data acquisition channel.
ChannelAddress* address = new ChannelAddress(CHANNEL_REALM, CHANNEL_OWNER, CHANNEL_SITE, CHANNEL_DEVICE);

// The actual transmitter element.
// Choose and configure a suitable transmitter, and that's it.
JsonHttpTransmitter* transmitter = new JsonHttpTransmitter(KOTORI_URL);
JsonMqttTransmitter* transmitter = new JsonMqttTransmitter(MQTT_TOPIC);
CrateDBTransmitter* transmitter = new CrateDBTransmitter(CRATEDB_URL, CRATEDB_USERNAME, CRATEDB_PASSWORD);
InfluxDBTransmitter* transmitter = new InfluxDBTransmitter(INFLUXDB_URL, INFLUXDB_USERNAME, INFLUXDB_PASSWORD);

// The telemetry client you will use for transmitting, see below.
telemetry = new TelemetryClient(transmitter, address);

Collect and transmit

// Collect sensor data.
TerkinData::Measurement measurement;
measurement.data["temperature"] = 42.42;
measurement.data["humidity"] = 80;

// Transmit measurement to telemetry data collection server.
telemetry->transmit(measurement);

/cc @msweef, @einsiedlerkrebs, @wetterfrosch, @Tonkenfo, @thiasB, @ClemensGruber, @marcelgasser, @rohlan

Footnotes

  1. The idea of TerkinTelemetry is to bring the flexibility of the telemetry subsystem of the Terkin MicroPython Datalogger on behalf of the self.device.telemetry.transmit(dataframe) within its transmit_readings() method, to the Arduino ecosystem.

  2. https://community.hiveeyes.org/t/telemetriesubsystem-fur-arduino-firmwares-generalisieren/181/14

@amotl amotl force-pushed the amo/terkin-telemetry-renovate branch from c452932 to 573ad57 Compare June 3, 2023 12:27
Base automatically changed from amo/sql to main June 4, 2023 15:15
@amotl amotl force-pushed the amo/terkin-telemetry-renovate branch 2 times, most recently from 36d417c to 0cb0e3f Compare June 4, 2023 17:15
@amotl amotl changed the title [TerkinTelemetry] Renovations [TerkinTelemetry] Renovations to improve the library interface, and to make things work Jun 4, 2023
@amotl amotl force-pushed the amo/terkin-telemetry-renovate branch from 0cb0e3f to c9ef39d Compare June 6, 2023 01:50
@amotl amotl force-pushed the amo/terkin-telemetry-renovate branch from c9ef39d to 2146b20 Compare June 6, 2023 01:52
@amotl amotl marked this pull request as ready for review June 6, 2023 01:54
@amotl amotl merged commit fb031d1 into main Jun 6, 2023
2 checks passed
@amotl amotl deleted the amo/terkin-telemetry-renovate branch June 6, 2023 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant