def page_load(): # bei jeder Seitenladung wird SQLConnector() erstellt -> zu langsam sql_object = SQLConnector() auto1 = sql_object.select_columns('befehle', 'Auto_Hand', 'id DESC LIMIT 1') auto = auto1[0][0] # auto = sps_values.get_bool(101, 0, 1) #ueber snap7 sql_res = {'Auto_Hand': auto} """ test = sql_object.select_columns('befehle', 'Quittierung', 'id DESC LIMIT 1') testbit = test[0][0] # testbit = sps_values.get_bool(101, 0, 1) #-> Auto, nur fuer Testzwecke sql_res = {'Testbit': testbit, 'Auto_Hand':auto} """ # print sql_res return jsonify(sql_res)
def anlage(): sql_object = SQLConnector() sql_res1 = sql_object.select_newest_row('meldungen') sql_res2 = sql_object.select_newest_row('messwerte_1s') sql_results = sql_object.select_newest_row('stoermeldungen') # print sql_res1 sql_results.update(sql_res1) sql_results.update(sql_res2) # Drehzahlen aus Tabelle sollwerte entnehmen n = sql_object.select_columns('sollwerte', 'n_R1, n_P2, n_P3', 'id DESC LIMIT 1') n_R1 = n[0][0] n_P2 = n[0][1] n_P3 = n[0][2] sql_results.update({'n_R1': n_R1, 'n_P2': n_P2, 'n_P3': n_P3}) # print sql_results return render_template("anlage.html", sql_results=sql_results)