# Milesight

## **Connecting Milesight to MClimate’s LoRaWAN broker**

### **1.** Go to <https://enterprise.mclimate.eu/integrations> and create your m-token.

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

Copy the token.

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

### **2. Go to Network Server-> Applications->{your\_application}->Add new Data transmission with type HTTP**

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

### **3. Add headers and URL**

{% hint style="warning" %}
Depending on your device firmware the fields values in this section are different, make sure you follow the instructions that match your firmware version. You can see it in the Status page.
{% endhint %}

<figure><img src="/files/Y5ZJpSV6aDBbsoCAN9Qu" alt=""><figcaption><p>Milesgiht Gateway Firmware version</p></figcaption></figure>

#### Firmware version  ≤ 60.0.0.42-r4 / 56.0.0.3-r1

* **Type - HTTP**
* **m-token:** your token from Enterprise *(Step 1)*
* **username:** apiuser *(this is not an example it is static for all gateways)*
* **password:** password *(this is not an example it is static for all gateways)*
* **url:** the public IP address of the gateway ***(ex: 212.39.89.221)***

{% hint style="warning" %}
Make sure that the IP is exposed and accessible from outside of your LAN. We need it for sending downlinks, if you are behind a NAT check your router for the public IP (the local one would not work).
{% endhint %}

A correctly filled out example is shown in the image below.

<figure><img src="/files/csRoWHb1WFA6dWYbBB5n" alt=""><figcaption><p>HTTP Header fields</p></figcaption></figure>

#### Firmware version ≥ 60.0.0.42-r5 / 56.0.0.4

With these newer Firmware devices you would need an AES-128 bit encrypted password. Using the link below you can easily generate one:

{% embed url="<https://anycript.com/crypto>" %}
AES encryption tool
{% endembed %}

Fill in the parameters from the table below:

| Parameter           | Value                                                               |
| ------------------- | ------------------------------------------------------------------- |
| Encryption text     | <mark style="color:blue;">THE LOGIN PASSWORD FOR THE GATEWAY</mark> |
| Secret Key          | 1111111111111111 (static value)                                     |
| Encryption Key Size | 128 Bits                                                            |
| Encryption Mode     | CBC                                                                 |
| IV (optional)       | 2222222222222222 (static value)                                     |
| Output format       | Base64                                                              |

A correctly filled out form would look as the one in the image below. Press the Encrypt button and you will be given a string to copy from the Encrypted Text field.

<figure><img src="/files/L2U1FTWaws6kJuVmsXW1" alt=""><figcaption><p>AES-128 bit encrypted password in Base64 form</p></figcaption></figure>

* **Type - HTTP**
* **m-token:** your token from Enterprise *(Step 1)*
* **username:** your gateway login username
* **password:** your gateway login password that we encrypted in the previous step
* **url:** the public IP address of the gateway ***(ex: 212.39.89.221)***

{% hint style="warning" %}
Make sure that the IP is exposed and accessible from outside of your LAN. We need it for sending downlinks, if you are behind a NAT check your router for the public IP (the local one would not work).
{% endhint %}

A correctly filled out example is shown in the image below.

<figure><img src="/files/5axWbOx6Lz7EQRMXaZZS" alt=""><figcaption><p>HTTP Header fields</p></figcaption></figure>

### **4.** Add URL

The uplink data URL should be:

<https://lorawan-broker.mclimate.eu/milesight>&#x20;

<figure><img src="/files/t7mmcUwbMTri91ACK1ql" alt=""><figcaption><p>MClimate URL</p></figcaption></figure>

### **5.** Done


---

# 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.mclimate.eu/mclimate-lorawan-devices/integrations/milesight.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.
