Respect global topic prefix when debug logging topic subscription

This commit is contained in:
zewelor
2018-12-23 09:48:01 +01:00
parent 460204ed72
commit 6496e88d7b
2 changed files with 2 additions and 2 deletions
+2
View File
@@ -1,4 +1,5 @@
import paho.mqtt.client as mqtt
from logger import _LOGGER
class MqttClient:
@@ -54,6 +55,7 @@ class MqttClient:
def callbacks_subscription(self, callbacks):
for topic, callback in callbacks:
topic = "{}/{}".format(self.topic_prefix, topic) if self.topic_prefix else topic
_LOGGER.debug("Subscribing to: %s" % topic)
self.mqttc.message_callback_add(topic, callback)
self.mqttc.subscribe(topic)
-2
View File
@@ -61,7 +61,6 @@ class WorkersManager:
raise "%s cannot be initialized, it has to define run or status_update method" % worker_name
if 'topic_subscription' in worker_config:
_LOGGER.debug("Subscribing to: %s" % worker_config['topic_subscription'])
self._mqtt_callbacks.append((
worker_config['topic_subscription'],
partial(self._on_command_wrapper, worker_obj)
@@ -69,7 +68,6 @@ class WorkersManager:
if 'topic_subscription' in config:
for (callback_name, options) in config['topic_subscription'].items():
_LOGGER.debug("Subscribing to: %s with command: %s" % (options['topic'], callback_name))
self._mqtt_callbacks.append((
options['topic'],
lambda client, _ , c: self._queue_if_matching_payload(self.Command(getattr(self, callback_name)), c.payload, options['payload']))