This commit is contained in:
parent
e59cba7603
commit
858c95220e
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import logging
|
||||||
import paho.mqtt.client as mqtt
|
import paho.mqtt.client as mqtt
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ class MQTT:
|
|||||||
"""
|
"""
|
||||||
self.client = mqtt.Client(client_id=self.client_id, clean_session=True, userdata=None, protocol=mqtt.MQTTv311,
|
self.client = mqtt.Client(client_id=self.client_id, clean_session=True, userdata=None, protocol=mqtt.MQTTv311,
|
||||||
transport="tcp")
|
transport="tcp")
|
||||||
|
self.port = int(self.port)
|
||||||
self.client.connect(host=self.host, port=self.port, keepalive=60)
|
self.client.connect(host=self.host, port=self.port, keepalive=60)
|
||||||
|
|
||||||
def publish(self, message: str, subtopic: str = "") -> None:
|
def publish(self, message: str, subtopic: str = "") -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user