# MQTT examples

Here is an example of MQTT configuration on the Ruuvi Gateway:

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

Here are sample commands to subscribe an MQTT client to notifications from the Ruuvi Gateway:

* Subscribe to service messages from this Gateway:\
  `mosquitto_sub -h test.mosquitto.org -p 1883 -t "ruuvi/AA:BB:CC:DD:EE:FF/gw_status" -v`
* Subscribe to service messages from any Gateway:\
  `mosquitto_sub -h test.mosquitto.org -p 1883 -t "ruuvi/#/gw_status" -v`
* Subscribe to messages from a Bluetooth sensor with the MAC:\
  `mosquitto_sub -h test.mosquitto.org -p 1883 -t "ruuvi/#/<TAG_MAC>/#" -v`
* Subscribe to messages from any Bluetooth sensor that this Gateway receives:\
  `mosquitto_sub -h test.mosquitto.org -p 1883 -t "ruuvi/AA:BB:CC:DD:EE:FF/#/#" -v`
* Subscribe to all messages:\
  `mosquitto_sub -h test.mosquitto.org -p 1883 -t "ruuvi/#" -v`\\


---

# 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.ruuvi.com/ruuvi-gateway-firmware/examples/mqtt-examples.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.
