def auth_run()

in authentication-function/src/authenticate.py [0:0]


def auth_run(context, event):
    """ Turn on Activate Light and unlock door.
    After proceeding this method, purchase process will begin by mqtt
    """
    # Activating right
    logger.info("START")

    # Turning on "Green Light(25)" "GPIO.output HIGH"
    LightControl.activate(LightControl.GREEN_LIGHT, deactivate_others=True)
    # Unlock "DOOR KEY(23) "GPIO.output LOW"
    SolenoidLock.unlock()

    local_storage = LocalStorage()
    operation = local_storage.read("qrType")
    if operation == "CUSTOMER":
        cmd = "aplay -D plughw:{},{} pick_instruction.wav".format(AUDIO_CARD,AUDIO_DEVICE)
        subprocess.call(cmd, shell=True)
    elif operation == "REFILL":
        cmd = "aplay -D plughw:{},{} refil_instruction.wav".format(AUDIO_CARD,AUDIO_DEVICE)
        subprocess.call(cmd, shell=True)

    # Debugging to Debug App
    # Value will be changed from "Locked" to "un-Locked"
    payload_info = json.dumps({'type': 'COMPONENT STATE CHANGE', 'data': {
        'title': 'Lock', 'fromValue': 'LOCKED', 'toValue': 'UNLOCKED', 'completedStepIndex': 1}}).encode()
    gg_client.publish(topic='{}/debug'.format(STACK_NAME), payload=payload_info)

    # Debugging to Debug App
    # Value will be changed "from Green Light off to on"
    payload_info = json.dumps({'data': {'title': 'GreenLightstrip', 'fromValue': 'OFF', 'toValue': 'ON'}}).encode()
    gg_client.publish(topic='{}/debug'.format(STACK_NAME), payload=payload_info)

    logger.info("END")