Using MQTT to send data to datonis

From Datonis
Revision as of 11:53, 10 July 2018 by Prashant (talk | contribs) (Created page with "<h1 id="mqttclientsenddatatodatonis">MQTT client send data to datonis.</h1> <p>MQTT protocol can be used to send metric data to datonis. MQTT is a bidirectinal pub/sub protoc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MQTT client send data to datonis.

MQTT protocol can be used to send metric data to datonis. MQTT is a bidirectinal pub/sub protocol. We publish event data to datonis in specified format and get acknowledge message on subscribing to another topic.

MQTT Connection Properties

  • Hostname: telemetry.datonis.io
  • Port: 1883
  • Username: access_key
  • Password: it is HMAC (SHA256) of access key using secret key. Use this link for getting password - https://www.freeformatter.com/hmac-generator.html , put access key in string input box, secret key in secret key box and select SHA256 as algorithm. then use computed HMAC as a Password
  • ClientID: unique 22 chars string. Same string is used in mqtt topics while publishing and subscribing.

Data Packet format

{
  "data": { "voltage": 233.43, "current": 10 },
  "thing_key": "178b43t47a",
  "access_key": "87a3f5b3317d9afdtbcbeba6527b4fd759923t5e",
  "timestamp": 1531180873940
}

Timestamp is epoch timestamp in milliseconds. voltage and current are properties present in thing template in which thing key 178b43t47 belongs to.

MQTT Topics

  • Altizon/Datonis/<clientid>/event for publishing messages to datonis. Use above mentioned data format while publishing messages.
  • Altizon/Datonis/<clientid>/httpAck this topic publishes acknowledgement of all received messages. This will also display if it gets any error while sending data to datonis. Subscribe to this topic for acknowledgements.

Example

Examples using https://chrome.google.com/webstore/detail/mqttlens/hemojaaeigabkbcookmlgmdigohjobjm this tool.

topics:

  • Altizon/Datonis/mqtt_87a3f5b3317d9afd/event
  • Altizon/Datonis/mqtt_87a3f5b3317d9afd/httpAck

Connection Properties:

Username: 87a3f5b3317d9afdtbcbeba6527b4fd759923t5e
Password: c725bdea20e523cdbfc7f100722fc9f0384c37e2c1cc5176e8631da8aa65c502
ClientID: mqtt_87a3f5b3317d9afd