# MQTT | Subscribe LoRa Device

### Prerequisites

1. Have MQTT FX software. If you don't have it, please go to the following [link MQTT FX](https://softblade.de/en/download-2/).
2. Have an active lora device and send data to the ANTARES Platform.

### Follow These Steps

1. Make sure you have activated the lora device and have also sent data to the ANTARES Platform. If not, you can follow the[ LoRa Tutorial](https://docs.antares.id/contoh-kode-dan-library/esp32-lora)
2. The active LoRa device will send data with an uplink type format and is included with the data, as in the example in the picture

<figure><img src="/files/CwjIrT2SlTRWCShJFW9F" alt=""><figcaption></figcaption></figure>

1. Copy the access key of the account you want to subscribe to.
2. Open the MQTT FX software. The user interface is shown in the following figure.<br>

   <figure><img src="/files/NJ6BmYMJ0KdVamaFRhbe" alt=""><figcaption></figcaption></figure>
3. Firstly, you need to configure so that you can connect with our MQTT Broker. The configuration is shown below.<br>

   <figure><img src="/files/fBjIuevOn3kmfsUHPKqD" alt=""><figcaption></figcaption></figure>
4. When you successfully connect, a green icon will appear on the top right.

<figure><img src="/files/4vZksAwGrGFIEN0vATeF" alt=""><figcaption></figcaption></figure>

1. Click Subscribe, then run subscribe a topic by following this format:

   <mark style="color:red;">`/oneM2M/resp/antares-cse/your-access-key/choose-a-serialization-format`</mark>\
   The <mark style="color:red;">choose-a-serialisation-format</mark> parameter can have 2 values:

   * <mark style="color:red;">`xml`</mark> for XML format
   * <mark style="color:red;">`json`</mark> for JSON format

   This step means that you will get a message/notification when there is a change in your account. In this tutorial, we use the MQTT FX tool to subscribe, but in real case scenarios, you can use your application to retrieve data from your LoRa device.<br>

   <figure><img src="/files/vbLJvKCteEYimoBMyGbA" alt=""><figcaption></figcaption></figure>
2. After subscribing to the topic with the correct topic format, you just need to wait until your device sends the data. If the data has been sent, it will appear in the column on the right as shown in the image.<br>

   <figure><img src="/files/DQLJ74Mgs6Vib6Ll4ViX" alt=""><figcaption></figcaption></figure>

   All data in "con" corresponds to the data sent from your device. You can create your own data format on your LoRa device.\
   \
   **Congratulations! You have just received your first request using the MQTT API.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.antares.id/en/code-and-library-examples/mqtt-or-subscribe-lora-device.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
