> For the complete documentation index, see [llms.txt](https://docs.mclimate.eu/mclimate-lorawan-devices/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mclimate.eu/mclimate-lorawan-devices/integrations/milesight.md).

# Milesight

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

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

<figure><img src="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FPkQDh2VcnU6YVItwD7Dm%2FScreenshot%202023-01-27%20at%2017.58.06.png?alt=media&amp;token=155fe676-5701-4943-bc03-b2d713c7f039" alt=""><figcaption></figcaption></figure>

Copy the token.

<figure><img src="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FIhIXLnQn2XI8nfa6Rhwj%2FScreenshot%202023-01-27%20at%2017.05.53.png?alt=media&amp;token=e51bae38-c8d6-4070-97bb-b886ca293635" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FrW2u3rBswC8Ohc4xbJq4%2FMilesight%200.png?alt=media&amp;token=2b0777ad-8b9d-4d56-be29-6729b40bfc59" 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="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FtgTGCFBZewVCmF4O4KB6%2Fimage.png?alt=media&amp;token=c9837b19-d0ff-4070-9add-f222302704e7" 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="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FVI8gAIGwWnfMiqVFSPEI%2Fimage.png?alt=media&amp;token=86811827-5fc2-43dd-859a-5e9efb2df650" 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="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FEE13x8Qu1bHrrp8Skvhn%2Fimage.png?alt=media&amp;token=f75d1742-0ad2-45dd-983e-825d0d6c7f2b" 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="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FTvbCbjyfDYtZ9sHGW2M4%2Fimage.png?alt=media&amp;token=1c1946c2-302d-4320-9011-98291a91db97" 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="https://3940008670-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McDr-jr9h3qA888r1Yp%2Fuploads%2FrIJakZ22JuBAb9cmGsGH%2Fimage.png?alt=media&amp;token=70e54ae8-6241-41c0-9b88-0fbb29d3946c" alt=""><figcaption><p>MClimate URL</p></figcaption></figure>

### **5.** Done


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mclimate.eu/mclimate-lorawan-devices/integrations/milesight.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
