From 03bb93e2eba613a207432503b6ea155278c32c7c Mon Sep 17 00:00:00 2001 From: zewelor Date: Wed, 19 Dec 2018 10:31:17 +0100 Subject: [PATCH] Fix global topic prefix handling (#32) --- mqtt.py | 2 +- workers/thermostat.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mqtt.py b/mqtt.py index 2f94792..24f7f35 100644 --- a/mqtt.py +++ b/mqtt.py @@ -59,7 +59,7 @@ class MqttClient: self.mqttc.connect(self.hostname, port=self.port) for topic, callback in callbacks: - if self.topic_prefix is not None: + if self.topic_prefix: topic = "{}/{}".format(self.topic_prefix, topic) self.mqttc.message_callback_add(topic, callback) self.mqttc.subscribe(topic) diff --git a/workers/thermostat.py b/workers/thermostat.py index 3f4dc8e..1023a42 100644 --- a/workers/thermostat.py +++ b/workers/thermostat.py @@ -71,7 +71,7 @@ class ThermostatWorker(BaseWorker): return ret def on_command(self, topic, value): - if self.topic_prefix is not None: + if self.topic_prefix: _, device_name, method, _ = topic[len(self.topic_prefix+"/"):].split('/') thermostat = self.devices[device_name]