fix stuff

This commit is contained in:
interfisch 2021-07-01 20:47:21 +01:00
parent 506615f3a3
commit c219d7cf5f
1 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,3 @@
import subprocess
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
import time import time
@ -8,7 +7,7 @@ from adafruit_ht16k33 import segments
__TOPIC_BRIGHTNESS__ = "brightness" __TOPIC_BRIGHTNESS__ = "brightness"
__TOPIC_SCROLL_INTERVAL__ = "scroll_interval" __TOPIC_SCROLL_INTERVAL__ = "scroll_interval"
__TOPIC_TEXT__ = "" __TOPIC_TEXT__ = "text"
class Controller: class Controller:
connected = False connected = False
@ -40,6 +39,8 @@ class Controller:
self.mqtt.connect(mqtt_host, mqtt_port) self.mqtt.connect(mqtt_host, mqtt_port)
self.topic = base_topic self.topic = base_topic
self.display.print("ABCD")
def on_disconnect(self, client, userdata, rc): def on_disconnect(self, client, userdata, rc):
print("MQTT disconnected") print("MQTT disconnected")
@ -74,7 +75,6 @@ class Controller:
self.mqtt.publish(self.topic + "/" + __TOPIC_TEXT__, self.text, 1 ) self.mqtt.publish(self.topic + "/" + __TOPIC_TEXT__, self.text, 1 )
def on_connect(self, client, userdata, flags, rc): def on_connect(self, client, userdata, flags, rc):
print("Connected to MQTT Broker") print("Connected to MQTT Broker")
self.mqtt.subscribe(self.topic + "/#") self.mqtt.subscribe(self.topic + "/#")
@ -88,9 +88,9 @@ class Controller:
self.mqtt.loop() self.mqtt.loop()
if self.display is not None: if self.display is not None:
self.display.print(self.text[self.poscount]) ##display.print(self.text[self.poscount])
display.print(42)
self.poscount += 1 self.poscount += 1
self.poscount %= len(self.text) self.poscount %= len(self.text)
time.sleep(self.scroll_interval) time.sleep(self.scroll_interval)