Create telemetry

Usage

ZED Hub allow on-the-edge computing, meaning that reported metrics have already been computed by the edge device.

We recommend to adapt the frequency of telemetry sent according to the nature of the data it is reporting. For example, reporting an ambient temperature might not require more than a 5-minute frequency.

Controlling the amount of telemetry sent to the cloud ensures that you do not reach ZED Hub’s rate limits, which would prevent your telemetry to be published in time.

Telemetry message

A telemetry payload is a format-free json document, however, you should make sure that you’re organizing your json attributes depending on the requests your planning.

Every telemetry message should be sent with a label identifying the type of telemetry sent for query performance while requesting a specific label.

{
    //Metadata, cloud will add time/device/application details
    ...,

    //Label
    "label": "environment",

    //Payload
    "payload": {
      "temperature": 24,
      "humidity": 64
    }
}

Our API allows to compute aggregation functions (sum, average, etc) and filters (time, application, label, etc) on the fields of the JSON payload to easily query your data.

While telemetry can contain any json document, query conditions cannot apply on arrays at the moment, so make sure that you’re not planning requests conditioned by values in arrays.

Send telemetry

In C++, the ZED Hub library provides the HubClient::sendTelemetry(...) function that can be used from any application.

  //Create a json
  sl_iot::json payload;
  payload["temperature"] = 24;
  payload["humidity"] = 64;

  //Send telemetry
  HubClient::sendTelemetry("environment", payload);

Python provides the same feature with the function HubClient.send_telemetry(...)

Please refer to the following tutorial for further information.

If your application uses the MQTT API, telemetries are sent to the /v1/devices/:deviceId/telemetry topic, as detailed in the MQTT API documentation.