Skip to main content

This is a wrapping class for using paho-mqtt(V2.x) in pyside6.

History

  • V0.2.x
    • Modity signal-slots type
    • Remote del
  • V0.1.x
    • Convert paho-mqtt callbacks to qt signal-slots
    • Add wrapper method for paho-mqtt

Install

pip install PySide6-PahoMqtt

Example

from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.PahoMqtt import Client

class UI(QMainWindow):
    def __init__(self):
        super().__init__()
        
        self.mqtt = Client()
        self.mqtt.on_connect.connect(self.onConnect)
        self.mqtt.on_connect_fail.connect(self.onConnectFail)
        self.mqtt.on_disconnect.connect(self.onDisconnect)
        self.mqtt.on_publish.connect(self.onPublish)
        self.mqtt.on_subscribe.connect(self.onSubscribe)
        self.mqtt.on_message.connect(self.onMessage)
        self.mqtt.connect("127.0.0.1")

    def closeEvent(self, event):
        print("Window is closing")
        self.mqtt.disconnect()
        event.accept()
        
    def onConnect(self, connect_flags, reason_code, properties):
        print(f"connect: {connect_flags}, {reason_code}, {properties}")
        
        if reason_code == 0:
            self.mqtt.subscribe("planxlabs/#")
            self.mqtt.publish("planxlabs/test", {"data": "Hello World"})
        else:
            print("fail")
    
    def onConnectFail(self):
        print("connect fail")   
        
    def onDisconnect(self, disconnect_flags, reason_code):
        print(f"disconnect: {disconnect_flags}, {reason_code}")   
                
    def onPublish(self, mid, reason_code):
        print(f"publish: {mid}, {reason_code}")
    
    def onSubscribe(self, mid, reason_code_list):
        print(f"subscribe: {mid}, {reason_code_list}")
    
    def onMessage(self, topic, payload, qos, retain, properties):
        print(f"message: {topic}, {payload}, {qos}, {retain}, {properties}")

if __name__ == "__main__":                            
    app = QApplication([])
    win = UI()
    win.show()
    app.exec()   

Metadata

Release files for PySide6-PahoMqtt 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PySide6-PahoMqtt 0.2.2
File Size Uploaded Provenance Actions
pyside6_pahomqtt-0.2.2.tar.gz 3.3 kB Without provenance Details for pyside6_pahomqtt-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PySide6-PahoMqtt 0.2.2
File Interpreter ABI Platform Actions
pyside6_pahomqtt-0.2.2-py3-none-any.whl Python 3 none any Details for pyside6_pahomqtt-0.2.2-py3-none-any.whl

Total release size: 8.0 kB

Release files / pyside6_pahomqtt-0.2.2.tar.gz

Download URL pyside6_pahomqtt-0.2.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0f5779ce9082e23a11ac2a8b37a6a0217c2a54a2c172c4441959018946506098
BLAKE2b-256 checksum
How to use checksums
33f3638d9946f15ec953e733722f28e239a6d0b42a91e74e9bf8d4507b374ef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / pyside6_pahomqtt-0.2.2-py3-none-any.whl

Download URL pyside6_pahomqtt-0.2.2-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46214a84455b168068c08125112803779beeddcde60e28450880166200b8ac0c
BLAKE2b-256 checksum
How to use checksums
df993e69bb49832184860fe451fe67dd29e50586d5d2cbb6b4d02d2c15e1f9f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for PySide6-PahoMqtt 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page