-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (26 loc) · 810 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
import os
from time import sleep
import lib.templates as templates
from lib.GPIO import GPIO
from lib.setup import setup
from lib.ws import WS
ROOT_DIR = os.getcwd()
if __name__ == "__main__":
GPIO.setup_leds()
GPIO.turn_off_all_led()
GPIO.blink_alert_led(on_time=0.05, off_time=0.05)
sleep(10)
SETUP = setup()
if isinstance(SETUP, str):
print(SETUP)
print("Error occured")
GPIO.error()
sleep(10)
os.system('sudo python3 /home/pi/printer/main.py')
else:
with open("/home/pi/printer/conf/conf.json", "r") as conf:
configuration = json.load(conf)
URL = configuration.get("ticketbutler").get("URL")
ws = WS(SETUP)
ws.ws_connect(URL, SETUP["printer_uuid"])