예제 #1
0
파일: alexa.py 프로젝트: zpriddy/Firefly
def echo_change_mode(intent):
  routine_list = getRoutineList()
  mode = intent.get('slots').get('mode').get('value').lower()
  close_matches = difflib.get_close_matches(mode, routine_list)
  
  if len(close_matches) > 0:
    routine = close_matches[0]
    myCommand = ffCommand(routine, None, routine=True, source="Echo command", force=True)
    if myCommand.result:
      return make_response("Changed mode to " + str(routine), "Changed mode to " + str(routine))
  
  return make_response("Error changing mode to " + str(mode), "Error changing mode to " + str(mode), card_title="Firefly Smart Home Error")
예제 #2
0
파일: ifttt.py 프로젝트: zpriddy/Firefly
def ifttt_change_mode(request):
    routine_list = getRoutineList()
    mode = request.get('mode').lower()
    if mode is None:
        return False
    close_matches = difflib.get_close_matches(mode, routine_list)
    if len(close_matches) > 0:
        routine = close_matches[0]
        myCommand = ffCommand(routine, None, routine=True,
                              source="IFTTT command", force=True)
        if myCommand.result:
            return True
    return False
예제 #3
0
def ifttt_change_mode(request):
    routine_list = getRoutineList()
    mode = request.get('mode').lower()
    if mode is None:
        return False
    close_matches = difflib.get_close_matches(mode, routine_list)
    if len(close_matches) > 0:
        routine = close_matches[0]
        myCommand = ffCommand(routine,
                              None,
                              routine=True,
                              source="IFTTT command",
                              force=True)
        if myCommand.result:
            return True
    return False
예제 #4
0
def echo_change_mode(intent):
    routine_list = getRoutineList()
    mode = intent.get('slots').get('mode').get('value').lower()
    close_matches = difflib.get_close_matches(mode, routine_list)

    if len(close_matches) > 0:
        routine = close_matches[0]
        myCommand = ffCommand(routine,
                              None,
                              routine=True,
                              source="Echo command",
                              force=True)
        if myCommand.result:
            return make_response("Changed mode to " + str(routine),
                                 "Changed mode to " + str(routine))

    return make_response("Error changing mode to " + str(mode),
                         "Error changing mode to " + str(mode),
                         card_title="Firefly Smart Home Error")