<reponame>popere/MagInkCal<filename>alexaskill.py
import logging
import os
 
from flask import Flask
from flask_ask import Ask, request, session, question, statement

from maginkcal import main;
 
app = Flask(__name__)
ask = Ask(app, "/")
logging.getLogger('flask_ask').setLevel(logging.DEBUG)
 
STATUSON = ["on", "switch on", "enable", "power on", "activate", "turn on"] # all values that are defined as synonyms in type
STATUSOFF = ["off", "switch off", "disactivate", "turn off", "disable", "turn off"]
STATUSMAGINKCALENDAR = ["actualizar", "recargar", "mostrar"] # maginkcalendar
 
@ask.launch
def launch():
    speech_text = 'Welcome to the Raspberry Pi alexa automation.'
    return question(speech_text).reprompt(speech_text).simple_card(speech_text)
 
@ask.intent('Calendar')
def Calendar():
    # if status in STATUSMAGINKCALENDAR:
    #     return statement('Light was turned on')
    # elif status in STATUSOFF:
    #     return statement('Light was turned off')
    # elif status in STATUSMAGINKCALENDAR:
    #     main()
    #     return statement('Cuadro ha sido acutalizado')
    # else:
    #     return statement('Sorry, this command is not possible.')
    main()
    return statement('Cuadro ha sido actualizado')
 
@ask.intent('AMAZON.HelpIntent')
def help():
    speech_text = 'You can say hello to me!'
    return question(speech_text).reprompt(speech_text).simple_card('HelloWorld', speech_text)
 
 
@ask.session_ended
def session_ended():
    return "{}", 200
 
 
if __name__ == '__main__':
    if 'ASK_VERIFY_REQUESTS' in os.environ:
        verify = str(os.environ.get('ASK_VERIFY_REQUESTS', '')).lower()
        if verify == 'false':
            app.config['ASK_VERIFY_REQUESTS'] = False
    app.run(debug=True)