door_lock.off() print("Come in boiz") sleep_ms(4000) door_lock.on() led_indicate.on() led_auth.off() else: print("Get out") led_indicate.off() led_reject.on() door_lock.on() sleep_ms(1000) led_indicate.on() led_reject.off() client.on_connect = on_connect client.set_callback(subscribe_calback) client.connect() client.subscribe(rfid_checkin, 0) # Initial state normal_boot = True #Wake up trigger pin pir_wake = Pin(34, mode = Pin.IN, pull = Pin.PULL_DOWN) esp32.wake_on_ext1([pir_wake], Pin.WAKE_HIGH) if machine.reset_cause() == machine.DEEPSLEEP_RESET: print('woke from a deep sleep, by the pulling of pin 34') if normal_boot: client.publish(device_state, "Wake from deepsleep")