fix indentations
This commit is contained in:
parent
adeabcae00
commit
c5f86c256d
|
@ -35,9 +35,9 @@ class Controller:
|
|||
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):
|
||||
|
@ -77,14 +77,14 @@ class Controller:
|
|||
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
|
||||
|
||||
|
@ -176,8 +176,8 @@ 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 = ""
|
||||
|
||||
|
||||
|
@ -261,10 +261,10 @@ class Controller:
|
|||
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue