added TUBE_INDEX to mqtt publisher and removed it at script start
Signed-off-by: Ebbe Baß <ebbe.bass>main
parent
7affda9c98
commit
31eb06a2ab
|
@ -43,11 +43,6 @@ db.autocommit(True)
|
||||||
|
|
||||||
mqtt_client_id = "PiXelTubeMaster-"+wlan_mac_address
|
mqtt_client_id = "PiXelTubeMaster-"+wlan_mac_address
|
||||||
|
|
||||||
cur = db.cursor()
|
|
||||||
cur.execute("SELECT mac_address, universe, dmx_address FROM tubes")
|
|
||||||
TUBE_INDEX = cur.fetchall()
|
|
||||||
cur.close()
|
|
||||||
|
|
||||||
# Function to register a tube in the database
|
# Function to register a tube in the database
|
||||||
def register_tube(mac_address):
|
def register_tube(mac_address):
|
||||||
cur = db.cursor()
|
cur = db.cursor()
|
||||||
|
@ -120,7 +115,10 @@ def mqtt_publisher():
|
||||||
artnetBindIp = get_eth0_ip()
|
artnetBindIp = get_eth0_ip()
|
||||||
artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454)
|
artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454)
|
||||||
while True:
|
while True:
|
||||||
print(TUBE_INDEX)
|
cur = db.cursor()
|
||||||
|
cur.execute("SELECT mac_address, universe, dmx_address FROM tubes")
|
||||||
|
TUBE_INDEX = cur.fetchall()
|
||||||
|
cur.close()
|
||||||
try:
|
try:
|
||||||
# Gets whatever the last Art-Net packet we received is
|
# Gets whatever the last Art-Net packet we received is
|
||||||
artNetPacket = artNet.readPacket()
|
artNetPacket = artNet.readPacket()
|
||||||
|
@ -149,12 +147,4 @@ if __name__ == "__main__":
|
||||||
flask_thread = Process(target=flask_api)
|
flask_thread = Process(target=flask_api)
|
||||||
flask_thread.start()
|
flask_thread.start()
|
||||||
publisher_thread = Process(target=mqtt_publisher)
|
publisher_thread = Process(target=mqtt_publisher)
|
||||||
publisher_thread.start()
|
publisher_thread.start()
|
||||||
# Tube index updater
|
|
||||||
while True:
|
|
||||||
cur = db.cursor()
|
|
||||||
cur.execute("SELECT mac_address, universe, dmx_address FROM tubes")
|
|
||||||
TUBE_INDEX = cur.fetchall()
|
|
||||||
cur.close()
|
|
||||||
print("Updated index: "+str(TUBE_INDEX))
|
|
||||||
time.sleep(1)
|
|
Loading…
Reference in New Issue