diff --git a/PyPI-README.md b/PyPI-README.md index d84d4c22b6b8baecf0c42a4b7517fe4c54301882..8c1c059489623d4df624a32413267dfd93ebc5a7 100644 --- a/PyPI-README.md +++ b/PyPI-README.md @@ -1,7 +1,6 @@ # WZL-MQTT -Current stable version: 2.5.4 - +Current stable version: 2.6.1 ## Documentation For the full API documentation, view [https://iot.wzl-mq.rwth-aachen.de/documentation/libs/mqtt/](https://iot.wzl-mq.rwth-aachen.de/documentation/libs/mqtt/). @@ -79,6 +78,13 @@ while True: ## Changelog +**2.6.1** - 2024-01-11 + - decoupled name of the client used locally from the name used when connecting to the broker to ensure independent clients using this library can use the same names locally + +**2.6.0** - 2024-01-10 + - added the classmethod "client_names()" to client to retrieve the name of all instances + - the classmethod "get(username)" of the client raises the "ChildNotFoundError" if there is no instance having the specified username + **2.5.4** - 2023-04-18 - fixed usage of a randomized client_id, so that the same credentials can be used for multiple clients in parallel diff --git a/README.md b/README.md index fa7446f08df15820ed813652586ffd9c0b4d6315..86a68f78bfdd2c8d073afbdd484067c53ca2cdee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # WZL-MQTT -Current stable version: 2.6.0 +Current stable version: 2.6.1 ## Documentation @@ -90,6 +90,9 @@ the European Union’s Horizon 2020 research and innovation programme and the EM ## Changelog +**2.6.1** - 2024-01-11 + - decoupled name of the client used locally from the name used when connecting to the broker to ensure independent clients using this library can use the same names locally + **2.6.0** - 2024-01-10 - added the classmethod "client_names()" to client to retrieve the name of all instances - the classmethod "get(username)" of the client raises the "ChildNotFoundError" if there is no instance having the specified username diff --git a/setup.py b/setup.py index 5e3a0a2043d43c43668ed2dd013a1e696b793784..0ca7c1807a32364838e375e95dadee5daf0849e1 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ with open("PyPI-README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup(name='wzl-mqtt', - version='2.6.0', + version='2.6.1', url='https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/', project_urls={ "Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/-/issues", diff --git a/src/mqtt/client.py b/src/mqtt/client.py index 03434b6e16b95338b1d0079e803bb2b9af4364c7..790cecf5832e965d5650813c8441674ebfa4a28a 100644 --- a/src/mqtt/client.py +++ b/src/mqtt/client.py @@ -44,6 +44,7 @@ class MQTTClient: 'MQTTClient') if logger is not None else Logger().get('MQTTClient') self.name = username if username is not None else str(uuid.uuid4()) + parentname = f'{username}-{str(uuid.uuid4())}' if username is not None else str(uuid.uuid4()) if self.name in MQTTClient.instances: self._logger.error( @@ -52,7 +53,7 @@ class MQTTClient: MQTTClient.instances[self.name] = self self.prefix = prefix - self._client = mqtt.Client(self.name, *args, **kwargs) + self._client = mqtt.Client(parentname, *args, **kwargs) self._client.on_connect = self._on_connect self._client.on_disconnect = self._on_disconnect