moved updater odwn

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-17 16:25:47 +01:00
parent 72ea1dc7c5
commit 395f3880a2
1 changed files with 10 additions and 10 deletions

View File

@ -114,16 +114,6 @@ def connect_mqtt():
client.connect("localhost", 1883)
return client
def update_tube_index():
while True:
cur = db.cursor()
cur.execute("SELECT mac_address, universe, dmx_address FROM tubes")
global TUBE_INDEX
TUBE_INDEX = cur.fetchall()
cur.close()
print("Updated index: "+str(TUBE_INDEX))
time.sleep(1)
def mqtt_publisher():
global TUBE_INDEX
# Create and start a thread for each universe
@ -156,6 +146,16 @@ def mqtt_publisher():
artNet.close()
sys.exit()
def update_tube_index():
while True:
cur = db.cursor()
cur.execute("SELECT mac_address, universe, dmx_address FROM tubes")
global TUBE_INDEX
TUBE_INDEX = cur.fetchall()
cur.close()
print("Updated index: "+str(TUBE_INDEX))
time.sleep(1)
if __name__ == "__main__":
tube_index_updater_thread = Process(target=update_tube_index)
tube_index_updater_thread.start()