diff --git a/src/controller.py b/src/controller.py index b84a9f0..5dcc9fb 100644 --- a/src/controller.py +++ b/src/controller.py @@ -49,13 +49,13 @@ class Controller: print("msg = " + msg) if message.topic.endswith(__TOPIC_BRIGHTNESS__ + "/set"): - val = float(msg) - if val >= 0.0 and val <=1.0: - self.display.brightness = val - print("changed brightness to ", self.display.brightness) - self.mqtt.publish(self.topic + "/" + __TOPIC_BRIGHTNESS__, self.display.brightness, 1 ) - else: - print("invalid brightness ", val) + val = float(msg) + if val >= 0.0 and val <=1.0: + self.display.brightness = val + print("changed brightness to ", self.display.brightness) + self.mqtt.publish(self.topic + "/" + __TOPIC_BRIGHTNESS__, self.display.brightness, 1 ) + else: + print("invalid brightness ", val) if message.topic.endswith(__TOPIC_SCROLL_INTERVAL__ + "/set"): val = float(msg)