Test MQTT topic

Send data to the cloud and read them in realtime on the web app

About test

Data reading and writing examples here below assumes that you are using the Eclipse Mosquitto client CLI, available at the official page https://mosquitto.org

Code placeholders

Code here follows uses placeholders that must be replaced with the actual values. So you should know in advance these variables:

machine ssl certificates names, contained in the zip file (see Get ssl certificates )

  • <certificate_crt>: named as xxxxxxxxxxxx-certificate.pem

  • <private_key>: named as xxxxxxxxxxxx-private.pem

  • <cafile_crt>: AmazonRootCA1.pem is the current file name

Publish data

timestamp must be expressed in milliseconds Sent data by here below snippet are: Cabinet_probe: 55, Evaporator_probe: 85

Further about machine variables in documentation page.

mosquitto_pub \
-h mqtt.things5.digital \
-q 1 \
-p 8883 \ 
-t things5-production/v1/devices/<device_id>/data_req \
-i things5-production-machine-<device_id> \
-m "{\"metrics\":[{\"timestamp\":0000000000000,\"data\":[{\"name\":\"Cabinet_probe\",\"value\":"55"},{\"name\":\"Evaporator_probe\",\"value\":"85"}]}]}" \
--cafile <cafile_crt> \
--cert <certificate_crt> \
--key <private_key> 

Visit monitoring page at this url (replace placeholders with their real values) to see published data

https://<realm-id>.things5.digital/machines/<device_id>/monitoring

Data stream monitor

Things5 lets you monitor device-broker-device message exchange as shown in this help section MQTT Diagnostic

Read configuration

Subscribe this topic to let Things 5 read configuration dataset from device (you'll also have to send the right response as explained in the API documentation)

mosquitto_sub \
-h mqtt.things5.digital \
-q 1 \
-p 8883 \ 
-t things5-production/v1/devices/<device_id>/cmd/read_variables_req \
-i things5-production-machine-<device_id> \
-v \
--cafile <cafile_crt> \
--cert <certificate_crt> \
--key <private_key> 

Visit configuration page at this url (replace placeholders with their real values) to see read data

https://<realm-id>.things5.digital/machines/<device_id>/configuration

Last updated