> For the complete documentation index, see [llms.txt](https://docs.kiloiot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiloiot.io/kilo-docs-fr/kilo-center/kilo-mioty-service-center/integrations/mqtt-first-steps.md). Agents can also search and read this documentation through its [MCP server](https://docs.kiloiot.io/~gitbook/mcp).

# Premiers pas avec MQTT

Premiers pas avec MQTT dans KiloCenter — activez le broker désactivé par défaut, abonnez-vous aux événements, publiez les liaisons descendantes.

### Objectif

Activez l’intégration MQTT et validez la consommation des événements ainsi que la publication des commandes.

### Prérequis

MQTT est **désactivé par défaut** dans KiloCenter. Avant d’utiliser MQTT :

1. Assurez-vous que le broker Mosquitto est en cours d’exécution (inclus dans la pile Docker Compose).
2. Activez MQTT dans `kilocenter-modules/KC-Core/config.yaml`:

```yaml
mqtt:
  enabled: true
  host: "localhost"
  port: 1883
  username: "admin"
  password: "KiloCenter"
```

3. Redémarrez KC-Core pour que la modification prenne effet.

### Valeurs par défaut du broker local

| Paramètre         | Valeur                                    |
| ----------------- | ----------------------------------------- |
| Broker            | `localhost:1883`                          |
| Nom d’utilisateur | `admin`                                   |
| Mot de passe      | `KiloCenter`                              |
| Préfixe de topic  | `mioty` (configurable dans `config.yaml`) |

### S’abonner aux événements de liaison montante

```bash
mosquitto_sub -h localhost -p 1883 \
  -u admin -P KiloCenter \
  -t 'mioty/+/device/+/event/up' -v
```

### Publier une commande de liaison descendante

```bash
mosquitto_pub -h localhost -p 1883 \
  -u admin -P KiloCenter \
  -t 'mioty/default/device/<EP_EUI_HEX>/command/down' \
  -m '{"data":"AQIDBA==","confirmed":false}'
```

Remplacez `<EP_EUI_HEX>` avec l’EUI de votre endpoint au format hexadécimal.

### Observer le topic de résultat

```bash
mosquitto_sub -h localhost -p 1883 \
  -u admin -P KiloCenter \
  -t 'mioty/+/device/<EP_EUI_HEX>/event/downlink_result' -v
```

### Contrat de topic et référence de charge utile

Pour la structure complète des topics et les formats de charge utile, voir :

* `kilocenter-modules/docs/mqtt-integration.md`


---

# 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.kiloiot.io/kilo-docs-fr/kilo-center/kilo-mioty-service-center/integrations/mqtt-first-steps.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.
