Allow disable topic subscription from config
This commit is contained in:
+7
-6
@@ -54,12 +54,13 @@ class WorkersManager:
|
|||||||
lambda client, _ , c: self._queue_command(self.Command(worker_obj.on_command, [c.topic, c.payload]))
|
lambda client, _ , c: self._queue_command(self.Command(worker_obj.on_command, [c.topic, c.payload]))
|
||||||
))
|
))
|
||||||
|
|
||||||
for (callback_name, options) in config['topic_subcription'].items():
|
if 'topic_subscription' in config:
|
||||||
_LOGGER.debug("Subscribing to: %s with command: %s" % (options['topic'], callback_name))
|
for (callback_name, options) in config['topic_subcription'].items():
|
||||||
self._mqtt_callbacks.append((
|
_LOGGER.debug("Subscribing to: %s with command: %s" % (options['topic'], callback_name))
|
||||||
options['topic'],
|
self._mqtt_callbacks.append((
|
||||||
lambda client, _ , c: self._queue_if_matching_payload(self.Command(getattr(self, callback_name)), c.payload, options['payload']))
|
options['topic'],
|
||||||
)
|
lambda client, _ , c: self._queue_if_matching_payload(self.Command(getattr(self, callback_name)), c.payload, options['payload']))
|
||||||
|
)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user