Ejemplo n.º 1
0
def addStateToScenario():
    id_scenario = int(request.form['id_scenario'])
    type_sensor = request.form['type']
    id_sensor = int(request.form['id'])
    operator = request.form['operator']
    value = float(request.form['value'])
    if type_sensor != 'temperature':
	operator = u"null"

    dao = DAO()
    dao.createState(id_scenario, id_sensor, type_sensor, value, operator)
    return json.dumps({'success': 'true', 'id_scenario' : id_scenario})
Ejemplo n.º 2
0
def createScenario():
    name = request.form['name']
    type_sensor = request.form['type']
    id_sensor = int(request.form['id'])
    operator = request.form['operator']
    value = float(request.form['value'])
    message = request.form['message']
    time = int(request.form['time'])
    if type_sensor != 'temperature':
	operator = u"null"

    dao = DAO()
    id_scenario = dao.createScenario(name, message, time)
    dao.createState(id_scenario, id_sensor, type_sensor, value, operator)
    return json.dumps({'success': 'true', 'id_scenario' : id_scenario})