Difference between revisions of "Using MQTT to send data to datonis"

From Datonis
Jump to: navigation, search
m (Prashant moved page Create page to Using MQTT to send data to datonis without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 19: Line 19:
 
<h2 id="datapacketformat">Data Packet format</h2>
 
<h2 id="datapacketformat">Data Packet format</h2>
  
<pre>{
+
<pre>{ "data": { "voltage": 233.43, "current": 10 },"thing_key": "178b43t47a","access_key": "87a3f5b3317d9afdtbcbeba6527b4fd759923t5e","timestamp": 1531180873940}
  "data": { "voltage": 233.43, "current": 10 },
 
  "thing_key": "178b43t47a",
 
  "access_key": "87a3f5b3317d9afdtbcbeba6527b4fd759923t5e",
 
  "timestamp": 1531180873940
 
}
 
 
</pre>
 
</pre>
  
Line 57: Line 52:
 
<tr><td>ClientID:</td><td> mqtt_87a3f5b3317d9afd</td></tr>
 
<tr><td>ClientID:</td><td> mqtt_87a3f5b3317d9afd</td></tr>
 
</table>
 
</table>
 +
 +
Connection Configuration as below
 +
 +
[[File:MQTT connection properties.png|1056x1056px]]
 +
 +
 +
Publish & Subscribe can be done as below
 +
 +
[[File:Publish & Subscribe topic.png|1056x1056px]]
 +
 +
<h2>Password Generation</h2>
 +
Password can be generated from access_key and secret_key as below.
 +
 +
[[File:MQTT_password_computation.png]]

Latest revision as of 18:15, 30 March 2022

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

Connection Configuration as below

MQTT connection properties.png


Publish & Subscribe can be done as below

Publish & Subscribe topic.png

Password Generation

Password can be generated from access_key and secret_key as below.

MQTT password computation.png