29 lines
828 B
Python
Raw Normal View History

2022-11-12 22:21:23 +08:00
import _mqtt
class MQTT(_mqtt._MQTT):
def __init__(self,
ip: str,
port=1883,
clinetID='mac',
username='',
password='',
version='3.1.1',
ca='',
keepalive=60):
2022-11-12 22:21:23 +08:00
super().__init__(ip, port, clinetID,
username, password, version,
ca, keepalive)
2022-12-27 17:01:56 +08:00
def subscribe(self, topic, cb, qos=1):
return super().subscribe(topic, cb, qos)
2022-12-27 17:01:56 +08:00
def publish(self, topic, payload, qos=1):
return super().publish(topic, payload, qos)
2022-12-27 17:01:56 +08:00
def setWill(self, topic, payload, qos=1, retain=0):
return super().setWill(topic, payload, qos, retain)
def unsubscribe(self, topic=''):
return super().unsubscribe(topic)