From c5f86c256d3f7927fea31d76101a2e8db04b2f2c Mon Sep 17 00:00:00 2001 From: Fisch Date: Sat, 19 Aug 2023 11:33:06 +0200 Subject: [PATCH] fix indentations --- src/controller.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/controller.py b/src/controller.py index 33d7700..d173a11 100644 --- a/src/controller.py +++ b/src/controller.py @@ -34,10 +34,10 @@ class Controller: connected = False displayL = None displayR = None - - basetopic = None - mqtthost = None - mqttport = None + + basetopic = None + mqtthost = None + mqttport = None def __init__(self, base_topic, mqtt_host, mqtt_port = 1883): @@ -76,15 +76,15 @@ class Controller: # set brightness, range 0-1.0, 1.0 max brightness self.displayL.brightness = 1.0 self.displayR.brightness = 1.0 - - self.basetopic = basetopic - self.mqtthost = mqtt_host - self.mqttport = mqtt_port + + self.basetopic = basetopic + self.mqtthost = mqtt_host + self.mqttport = mqtt_port - connectToMQTT() + connectToMQTT() - def connectToMQTT(self): - print("trying to connect to mqtt") + def connectToMQTT(self): + print("trying to connect to mqtt") self.mqtt = mqtt.Client() self.mqtt.on_connect = self.on_connect self.mqtt.on_message = self.on_message @@ -97,7 +97,7 @@ class Controller: def on_disconnect(self, client, userdata, rc): print("MQTT disconnected") - self.mode = Mode.STATIC + self.mode = Mode.STATIC self.text = "- - - -" self.connected = False @@ -175,9 +175,9 @@ class Controller: self.mqtt.publish(self.topic + "/" + "$hostname", socket.gethostname() , 1 ) self.mqtt.publish(self.topic + "/" + "$localip", self.get_ip() , 1 ) - - #clear display - self.mode = Mode.STATIC + + #clear display + self.mode = Mode.STATIC self.text = "" @@ -260,13 +260,13 @@ class Controller: run = True while run: - - if !self.connected: - if (time.time()>self.last_reconnectTry+30): - connectToMQTT() - self.last_reconnectTry=time.time() + + if !self.connected: + if (time.time()>self.last_reconnectTry+30): + connectToMQTT() + self.last_reconnectTry=time.time() self.mqtt.loop(0.1) #with block timeout - + if self.displayL is not None and self.displayR is not None: #displays initialized