> For the complete documentation index, see [llms.txt](https://docs.ruuvi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ruuvi.com/ruuvi-gateway-firmware/examples/mqtt-examples.md).

# MQTT examples

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

<figure><img src="https://1423309131-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsPjfnhNj3v37AZtF-d%2Fuploads%2Fgit-blob-c180e79b0fe1aea1b1c74e52ab4b953140d2b5d6%2FScreenshot%20from%202023-12-13%2010-23-45.png?alt=media" 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`\\
