21 lines
586 B
Python
21 lines
586 B
Python
from MqttBase import AbstractMqttPublisher
|
|
from loguru import logger
|
|
from time import sleep
|
|
|
|
|
|
class TestSubscribe(AbstractMqttPublisher):
|
|
def __init__(self, config):
|
|
super().__init__(config)
|
|
|
|
def localLoop(self):
|
|
while not self.killBill:
|
|
sleep(60.0)
|
|
|
|
def onMessage(self, topic, payload):
|
|
logger.warning("mqtt message received: {} -> {}".format(topic, str(payload)))
|
|
|
|
def onConnect(self):
|
|
logger.info("mqtt connected")
|
|
self.client.subscribe("{}".format(self.config["subscribeTopic"]))
|
|
logger.info("subscribed")
|