A production-ready, GUI-based MQTT Client & Data Logger. Built with Python Tkinter and the latest Paho-MQTT v2.0.
Most free MQTT tools (like MQTT.fx or MQTT Explorer) are great for viewing data, but hard to customize or integrate into your own logic.
This project provides a Full Python Source Code template that handles:
- ✅ Secure Auth: Support for Username/Password & Custom Ports (essential for Cloud Brokers like HiveMQ/EMQX).
- ✅ Paho-MQTT v2.0: Compliant with the latest API standards (no deprecation warnings).
- ✅ Auto CSV Logging: Instantly saves
Topic,Payload, andTimestampto CSV. - ✅ Subscription Check: Detects if the broker REJECTS your subscription (e.g., wrong wildcard usage).
- GUI Interface: Clean Tkinter UI. No HTML/JS knowledge required.
- Non-Blocking: Threaded architecture keeps the UI responsive.
- Instant Export: Data is saved to
mqtt_log.csvin real-time. - Error Handling: Visual feedback for connection failures or subscription rejections.
Only one external library is required:
pip install paho-mqtt📥 Download Full Source Code You can get the Complete Source Code (main.py) which includes the full GUI implementation, threading logic, and the Paho v2.0 callback structure.
It is fully commented and ready to be customized for your own automation projects.
👉 Download on Gumroad ($29): [link]
(Includes: main.py, requirements.txt, and Setup Guide)
📖 Code Snippet (Paho v2.0 Logic) The code implements the latest callback API to ensure future compatibility:
Python
# Support for Paho-MQTT v2.0 Callback API
def on_subscribe(self, client, userdata, mid, reason_code_list, properties):
# Check if subscription was granted (Code >= 128 means failure)
if reason_code_list[0] >= 128:
self.log_message(f"❌ Subscription REJECTED!")
else:
self.log_message(f"✅ Subscribed successfully.")
# Initialize with VERSION2 to avoid DeprecationWarning
self.client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
👨💻 About the Author Phil Yeh - Senior Automation Engineer
My Gumroad Store (More Engineering Tools)
Keywords: MQTT, Python, Paho-MQTT, IoT, Data Logger, GUI, Source Code, Automation, Tkinter, SCADA
