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")
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