added fail safe if pxm isn't reacheable
Signed-off-by: Ebbe Baß <ebbe.bass>
This commit is contained in:
@@ -8,6 +8,7 @@ from threading import Thread
|
||||
import paho.mqtt.client as mqtt
|
||||
from getmac import get_mac_address
|
||||
import board
|
||||
import sys
|
||||
|
||||
SERVER_IP = '192.168.0.1'
|
||||
SERVER_PORT = 5000
|
||||
@@ -101,6 +102,7 @@ def loopCheckSettingUpdates():
|
||||
print(universe, dmx_address)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
sys.exit()
|
||||
time.sleep(2)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
+5
-6
@@ -52,13 +52,12 @@ def register_tube(mac_address):
|
||||
|
||||
print(existing_tube)
|
||||
|
||||
if existing_tube is not None:
|
||||
# Tube already exists, do nothing for now
|
||||
pass
|
||||
else:
|
||||
# Tube is new, insert into the database
|
||||
# Check if the tube exsist. If it doesn't create a new db row
|
||||
if existing_tube is None:
|
||||
cur.execute("INSERT INTO tubes (mac_address, universe, dmx_address) VALUES (%s, %s, %s)",
|
||||
(mac_address, 0, 1)) # Universe 0, DMX Address 1
|
||||
(mac_address, 0, 1))
|
||||
else:
|
||||
pass
|
||||
cur.close()
|
||||
|
||||
# Registration system route
|
||||
|
||||
Reference in New Issue
Block a user