1. intro
we will use some basic commands to ensure the MQTT broker is working well and receive published messages from your IOT devices.
![]() |
install on your workstation the package with the mqtt commands |
the broker has a DNS entry with mq.d01.net and can be interrogated, first on a high level with:
mosquitto_sub -h mq.d01.net -u admin -P xx -t '$SYS/#' -d
Client null sending CONNECT
Client null received CONNACK (0)
Client null sending SUBSCRIBE (Mid: 1, Topic: $SYS/#, QoS: 0, Options: 0x00)
Client null received SUBACK
Subscribed (mid: 1): 0
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/version', ... (24 bytes))
mosquitto version 1.6.15
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/uptime', ... (12 bytes))
1510 seconds
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/clients/total', ... (1 bytes))
1
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/clients/active', ... (1 bytes))
1
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/clients/connected', ... (1 bytes))
1
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/messages/received/1min', ... (5 bytes))
20.18
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/messages/received/5min', ... (5 bytes))
15.10
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/messages/received/15min', ... (5 bytes))
10.22
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/messages/sent/1min', ... (6 bytes))
267.92
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/messages/sent/5min', ... (5 bytes))
78.90
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/messages/sent/15min', ... (5 bytes))
33.75
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/publish/sent/1min', ... (6 bytes))
250.24
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/publish/sent/5min', ... (5 bytes))
64.60
Client null received PUBLISH (d0, q0, r1, m0, '$SYS/broker/load/publish/sent/15min', ... (5 bytes))
23.94
///
next, we will interrogate the broker again, specific on the tree level:
mosquitto_sub -h mq.d01.net -u admin -P xx -t '#' -d
Client null sending CONNECT
Client null received CONNACK (0)
Client null sending SUBSCRIBE (Mid: 1, Topic: #, QoS: 0, Options: 0x00)
Client null received SUBACK
Subscribed (mid: 1): 0
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/relay/0', ... (3 bytes))
off
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input/0', ... (1 bytes))
0
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input_event/0', ... (26 bytes))
{"event":"","event_cnt":0}
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/relay/0', ... (3 bytes))
off
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input/0', ... (1 bytes))
0
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input_event/0', ... (26 bytes))
{"event":"","event_cnt":0}
Client null sending PINGREQ
Client null received PINGRESP
///
![]() |
learn from previous sample what topicname your IOT device is using |
2. query
we will query a specific topic entry, based on wildcards:
mosquitto_sub -h mq.d01.net -u admin -P xx -t 'shellies/#' -d
Client null sending CONNECT
Client null received CONNACK (0)
Client null sending SUBSCRIBE (Mid: 1, Topic: shellies/#, QoS: 0, Options: 0x00)
Client null received SUBACK
Subscribed (mid: 1): 0
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/relay/0', ... (3 bytes))
off
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input/0', ... (1 bytes))
0
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input_event/0', ... (26 bytes))
{"event":"","event_cnt":0}
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/relay/0', ... (3 bytes))
off
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input/0', ... (1 bytes))
0
Client null received PUBLISH (d0, q0, r0, m0, 'shellies/shelly1-3083988C0311/input_event/0', ... (26 bytes))
{"event":"","event_cnt":0}
Client null sending PINGREQ
Client null received PINGRESP
3. cases
shellies/shellyplug-s-43F7D0/relay/0
shellies/shelly1-3083988C0311/relay/0
mosquitto_sub -h d01cid.ddns.net -u admin -P Passw0rd -t 'shellies/ssw041/relay/0'