Add a message id to the received messages

This commit is contained in:
Dirk Alders 2024-05-27 11:35:46 +02:00
parent 328d3471a7
commit 14e56ccdbf

View File

@ -88,6 +88,7 @@ class mqtt_client(object):
logger.warning("Disconnect with rc=%s", repr(rc)) logger.warning("Disconnect with rc=%s", repr(rc))
def __receive__(self, client, userdata, message): def __receive__(self, client, userdata, message):
message.mid = self.__client__._mid_generate() # add a message id to the received message
get_topic_logger(message.topic).debug("Received message with topic %s and payload %s", message.topic, str(message.payload)) get_topic_logger(message.topic).debug("Received message with topic %s and payload %s", message.topic, str(message.payload))
for topic in self.__callbacks__.copy(): for topic in self.__callbacks__.copy():
if topic.endswith('#'): if topic.endswith('#'):