> For the complete documentation index, see [llms.txt](https://admin-things5.gitbook.io/things5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://admin-things5.gitbook.io/things5/integrations/devices-and-provisioning/test-mqtt-topic.md).

# Test MQTT topic

## About test&#x20;

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:

* **\<realm-id>**: identifier of the organization (see [Get organisation-id](/things5/integrations/devices-and-provisioning/get-realm-id.md))
* **\<device\_id>**: identifier of the machine (see [Get device-id](/things5/integrations/devices-and-provisioning/get-device-id.md))

machine ssl certificates names, contained in the zip file (see [Get ssl certificates](/things5/integrations/devices-and-provisioning/get-ssl-certificates.md) )

* **\<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&#x20;

{% hint style="warning" %}
**timestamp** must be expressed in milliseconds\
Sent data by here below snippet are: Cabinet\_probe: 55, Evaporator\_probe: 85

Further about [machine variables](/things5/device/manage-firmware/machine-variables.md) in documentation page.
{% endhint %}

```
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](/things5/integrations/devices-and-provisioning/mqtt-diagnostic.md)

## 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
```
