def change_power(): if int(request.form['power']) == 0: power = False else: power = True write_command_sql(power=power) return jsonify({}, 200, {})
def demo_color(): red = int(request.form['red']) green = int(request.form['green']) blue = int(request.form['blue']) hex = convert_rgb_to_hex(red, green, blue) write_command_sql(color=hex) return jsonify({}, 200, {})
def delete_color(): color_id = int(request.form['color_id']) # print('got our id boy', color_id) hex = get_color_hex(color_id) # print('got our hex boy: {}'.format(hex)) write_command_sql(delete=hex) return jsonify({}, 200, {})
def save_color(): red = int(request.form['red']) green = int(request.form['green']) blue = int(request.form['blue']) name = request.form['name'] hex = convert_rgb_to_hex(red, green, blue) write_command_sql(save=[hex, name]) return jsonify({}, 200, {})
def change_mode(): mode = int(request.form['mode']) write_command_sql(mode=mode) return jsonify({}, 200, {})
def change_leds(): led_1 = int(request.form['led_1']) led_2 = int(request.form['led_2']) led_3 = int(request.form['led_3']) write_command_sql(colors=[led_1, led_2, led_3]) return jsonify({}, 200, {})
def change_timer_power(): if request.form['power'].lower() == 'true': write_command_sql(timerset=1) else: write_command_sql(timerset=0) return jsonify({}, 200, {})
def change_times(): ontime = request.form['ontime'] offtime = request.form['offtime'] write_command_sql(ontime=ontime, offtime=offtime) return jsonify({}, 200, {})
def delete_mode(): mode_id = int(request.form['mode_id']) write_command_sql(deletemode=mode_id) return jsonify({}, 200, {})
def save_mode(): color_list = request.form['colors'] name = request.form['name'] write_command_sql(addmode=[name, color_list]) return jsonify({}, 200, {})
def change_sync(): sync = int(request.form['sync']) write_command_sql(sync=sync) return jsonify({}, 200, {})
def change_shifter(): shifter = int(request.form['shifter']) write_command_sql(shifter=shifter) return jsonify({}, 200, {})
def change_delay(): delay = float(request.form['delay']) write_command_sql(delay=delay) return jsonify({}, 200, {})
def change_brightness(): brightness = float(request.form['brightness']) write_command_sql(bright=brightness) return jsonify({}, 200, {})