20 lines
443 B
Python
20 lines
443 B
Python
import paho.mqtt.client as mqtt
|
|
import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
class TicPublisher:
|
|
def __init__(self, hostname=None, port=1883):
|
|
self.client = None
|
|
if hostname:
|
|
self.client = mqtt.Client()
|
|
self.client.connect(hostname, port)
|
|
#self.client.loop_start()
|
|
|
|
def close(self):
|
|
if self.client:
|
|
#self.client.loop_stop()
|
|
self.client = None
|
|
|