from access_control import access_control
from line_notify import LineNotify
import time 

stm32 = access_control("COM12")
time.sleep(1)
door_state = False
while True:
    print(stm32._in_payloads)
    if(door_state != stm32.get_door_state()):
        door_state = stm32.get_door_state()
        notify = LineNotify("olK1QXriiuKgfxB6xkj7SIFfj9jsXfpl2PqmjCDuBRw")
        notify.send(f'door is {door_state}')
    if(stm32.get_door_state() == True):
        stm32.lock_door()
    else:
        stm32.unlock_door()
    time.sleep(0.01)
