tic2mqtt/tic_mqtt.py

20 lines
443 B
Python
Raw Normal View History

2024-05-26 15:42:50 +02:00
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