Chapters

13 Lab 2: Python MQTT Dashboard

mqtt
implementation
labs

This is the second bounded MQTT lab. Reuse the unique topic suffix recorded in Lab 1 so the dashboard sees your publisher rather than another learner’s public-broker traffic.

13.1 Lab 2: Python MQTT Dashboard with Multiple Sensors

Objective: Create a real-time dashboard that subscribes to multiple sensor topics and displays data.

Materials:

Build the decision in sequence. Begin with Python 3.7+. Then consider paho-mqtt library. Close by considering (Optional) Running ESP32 from Lab 1.

Expected Output:

IoT MQTT Dashboard - Real-Time Sensor Data

LAB1
Temperature      22.50C              [14:32:15] QoS:0
Humidity         45.30%               [14:32:15] QoS:0
Status           Status: online       [14:32:10] QoS:0

Total messages received: 127
Last update: 14:32:15

Press Ctrl+C to exit

Learning Outcomes:

Build the decision in sequence. Begin with Subscribe to multiple MQTT topics with wildcards. Then consider Build real-time data visualization. Then consider Implement alert systems based on sensor data. Then consider Handle MQTT callbacks and data processing. Close by considering Create user-friendly console interfaces.

Lab 2 handoff

Save one dashboard trace that includes the topic, timestamp, value, and alert decision. Continue to Lab 3: MQTT Home Automation when that trace proves your subscriber is following the intended topic tree.