Blocking callbacks till connection is established

This commit is contained in:
Dirk Alders 2022-09-13 06:51:17 +02:00
parent 3d9fc164b4
commit cf97fa066c

View File

@ -41,7 +41,7 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
class mqtt_client(object): class mqtt_client(object):
def __init__(self, name, host, port=1883, username=None, password=None): def __init__(self, name, host, port=1883, username=None, password=None):
self.__block_add_callbacks__ = False self.__block_add_callbacks__ = True
logger.info("Initiating mqtt client instance") logger.info("Initiating mqtt client instance")
self.__callbacks__ = {} self.__callbacks__ = {}
self.__client__ = paho.Client(name) # create client object self.__client__ = paho.Client(name) # create client object