added fail safe if pxm isn't reacheable

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-17 01:02:05 +01:00
parent 28b8731afc
commit 9aa44f1292
2 changed files with 7 additions and 6 deletions

View File

@ -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__":

View File

@ -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