Skip to content
Snippets Groups Projects
Commit 82ef4d2b authored by Matthias Stefan Bodenbenner's avatar Matthias Stefan Bodenbenner
Browse files

8.2.3

parent b8b535f6
Branches
No related tags found
No related merge requests found
Pipeline #249828 passed
# WZL-MQTT # WZL-MQTT
Current stable version: 2.5.1 Current stable version: 2.5.2
## Documentation ## Documentation
...@@ -78,6 +78,10 @@ while True: ...@@ -78,6 +78,10 @@ while True:
``` ```
## Changelog ## Changelog
**2.5.2** - 2023-03-29
- client handles slash in at the end of prefix and the beginning of topic to avoid multiple consecutive slashes correctly now
2.5.1 2.5.1
- increased verbosity in case of errors by including the full stack trace - increased verbosity in case of errors by including the full stack trace
......
# WZL-MQTT # WZL-MQTT
Current stable version: 2.5.1 Current stable version: 2.5.2
## Documentation ## Documentation
...@@ -89,6 +89,10 @@ European Metrology Programme for Innovation and Research EMPIR). The EMPIR initi ...@@ -89,6 +89,10 @@ European Metrology Programme for Innovation and Research EMPIR). The EMPIR initi
the European Union’s Horizon 2020 research and innovation programme and the EMPIR Participating States. the European Union’s Horizon 2020 research and innovation programme and the EMPIR Participating States.
## Changelog ## Changelog
**2.5.2** - 2023-03-29
- client handles slash in at the end of prefix and the beginning of topic to avoid multiple consecutive slashes correctly now
2.5.1 2.5.1
- increased verbosity in case of errors by including the full stack trace - increased verbosity in case of errors by including the full stack trace
......
...@@ -30,20 +30,15 @@ Receiving MQTT Messages ...@@ -30,20 +30,15 @@ Receiving MQTT Messages
logger = mqtt.root_logger.get('Receiver') logger = mqtt.root_logger.get('Receiver')
# username and password required to connect to the broker
MQTT_USER = "" MQTT_USER = ""
MQTT_PASSWORD = "" MQTT_PASSWORD = ""
# address, port and virtual host of the broker to connect to
MQTT_BROKER = "127.0.0.1" MQTT_BROKER = "127.0.0.1"
MQTT_PORT = 1883 MQTT_PORT = 1883
MQTT_VHOST = "/" MQTT_VHOST = "/"
## To connect to the central MQTT-Broker of MQ-MS use the settings below.
## Ask Mark Sanders (sdr) or Matthias Bodenbenner (bdn) for personal credentials.
## Set the "ssl" flag of the connect function to "True".
# MQTT_BROKER = "mqtt.wzl-mq.rwth-aachen.de"
# MQTT_PORT = 8883
# MQTT_VHOST = "metrology"
topic = "#" # set topic to subscribe according to MQTT syntax! topic = "#" # set topic to subscribe according to MQTT syntax!
qos = 0 # set QoS according to MQTT specifications! qos = 0 # set QoS according to MQTT specifications!
......
...@@ -4,7 +4,7 @@ with open("PyPI-README.md", "r", encoding="utf-8") as fh: ...@@ -4,7 +4,7 @@ with open("PyPI-README.md", "r", encoding="utf-8") as fh:
long_description = fh.read() long_description = fh.read()
setup(name='wzl-mqtt', setup(name='wzl-mqtt',
version='2.5.1', version='2.5.2',
url='https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/', url='https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/',
project_urls={ project_urls={
"Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/-/issues", "Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/iot/mqtt/-/issues",
......
...@@ -210,7 +210,7 @@ class MQTTPublisher(MQTTClient): ...@@ -210,7 +210,7 @@ class MQTTPublisher(MQTTClient):
""" """
try: try:
if self.prefix is not None and self.prefix != "": if self.prefix is not None and self.prefix != "":
self._client.publish(self.prefix + "/" + topic.strip("/"), self._client.publish(self.prefix.strip("/") + "/" + topic.strip("/"),
message, qos, retain) message, qos, retain)
else: else:
self._client.publish(topic.strip("/"), message, qos, retain) self._client.publish(topic.strip("/"), message, qos, retain)
...@@ -272,7 +272,7 @@ class MQTTSubscriber(MQTTClient): ...@@ -272,7 +272,7 @@ class MQTTSubscriber(MQTTClient):
SubscriptionError: If topic could not be subscribed successfully. SubscriptionError: If topic could not be subscribed successfully.
""" """
try: try:
topic = f'{self.prefix}/{topic}' if self.prefix is not None and self.prefix != "" else topic topic = f'{self.prefix.strip("/")}/{topic.strip("/")}' if self.prefix is not None and self.prefix != "" else topic
for s in self._subscriptions: for s in self._subscriptions:
if s["topic"] == topic: if s["topic"] == topic:
raise RuntimeError( raise RuntimeError(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment