예제 #1
0
async def stop_calibration():
    pump_type = request.args.get('type')
    print(pump_type)
    resp = {}
    if pump_type in ['conditioner', 'co2', 'fertilizer']:
        controller.stop_cal()
        if controller.cal_time:
            resp['cal_time'] = controller.cal_time
        else:
            resp['error'] = 'Calibration was cancelled'
    else:
        resp['error'] = 'Invalid pump type'
    return jsonify(resp)
async def update_db():
    transaction_id = request.args.get('transact_id')
    contact_no = request.args.get('contact_no')
    session_id = request.args.get('session_id')
    conn = pymssql.connect('DBSERVER', 'DBUSER', 'DBPASS', "DBNAME")
    cursor = conn.cursor()
    cursor.execute("UPDATE transactionTable set transactionID='" +
                   transaction_id + "',contactNumber='" + contact_no +
                   "' WHERE ID=" + session_id)
    conn.commit()
    response = {'result': "OK", 'message': "Database updated"}
    cursor.close()
    conn.close()
    return json.jsonify(response)
async def send_message():
    number = request.args.get('number')
    message = request.args.get('message')
    response = {}
    if number and message:
        if not client.is_connected():
            await client.connect()
        try:
            message_object = await (client.send_message(number, message))
            response['message'] = str(message_object)
            response['result'] = "OK"
        except ValueError:
            response['message'] = "Recepient name or number not found "
            response['result'] = "ERROR"
        except:
            response['message'] = "Error sending message"
            response['result'] = "ERROR"
    else:
        response['message'] = "Params missing"
        response['result'] = "ERROR"

    return json.jsonify(response)
예제 #4
0
async def playlist():
    return jsonify([])
예제 #5
0
async def get_server_data():
    print("Sending Data to Client")
    return jsonify(utils.load())
예제 #6
0
async def get_conversions_tanksize():
    print(f"Sending Tank Size")
    return jsonify(utils.load())
예제 #7
0
 async def delete(self):
     """
     Delete treatments
     """
     return jsonify({'status': 'Not implemented'})
예제 #8
0
 async def post(self):
     """
     Submit new treatments
     """
     return jsonify({'status': 'Not implemented'})
예제 #9
0
 def get(self):
     return jsonify(json_serializers.serialize_default(self.stage))
예제 #10
0
async def update():
    data = controller.update()
    return jsonify(data)
async def root():
    response = {'status': '200 OK'}
    return json.jsonify(response)
예제 #12
0
 def task_test(self):
     # task = FlickerDim(self.stage.grid_front_left, length=None)
     # task = FlickerDim(self.stage.all, length=None)
     task = SineRainbow(self.stage.all)
     self.scheduler.add_task(task, 2)
     return jsonify(json_serializers.serialize_default(task))
예제 #13
0
 def get_list(self):
     return jsonify(json_serializers.serialize_default(self.scheduler._tasks))
예제 #14
0
 def get_by_id(self, id):
     print(id)
     return jsonify(json_serializers.serialize_default([self.universe]))
예제 #15
0
 def get_list(self):
     return jsonify(json_serializers.serialize_default([self.universe]))
예제 #16
0
async def get_server_data():
    print("Sending Data to Client")
    data = controller.load_data()
    return jsonify(data)
예제 #17
0
async def load_config():
    print("Sending Config to Client")
    config_data = controller.load_config()
    print(f"Return Config: {config_data}")
    return jsonify(config_data)
예제 #18
0
 async def get(self):
     """
     Get all entries matching the query
     """
     return jsonify(json_list=app.db_session.query(Entry).all())
예제 #19
0
 async def get(self):
     """
     Get all treatments matching the query
     """
     return jsonify(json_list=app.db_session.query(Treatment).all())
예제 #20
0
 async def swagger_blueprint_config_handler():
     return jsonify(doc.get_config(request.host))