|
@@ -1,35 +1,36 @@
|
|
|
-
|
|
|
-from app import create_app
|
|
|
-from flask import request
|
|
|
-from gevent import pywsgi
|
|
|
-
|
|
|
-
|
|
|
-app, db, mqtt = create_app()
|
|
|
-
|
|
|
-
|
|
|
-@mqtt.on_connect()
|
|
|
-def handle_connect(client, userdata, flags, rc):
|
|
|
-
|
|
|
-
|
|
|
- mqtt.subscribe('AISKY/Coffee/MK-G/b8:27:eb:b4:59:3e/Log')
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-@mqtt.on_log()
|
|
|
-def handle_logging(client, userdata, level, buf):
|
|
|
- print(client, userdata, level, buf)
|
|
|
-
|
|
|
-
|
|
|
-@app.teardown_appcontext
|
|
|
-def shutdown_session(exception=None):
|
|
|
- db.session.remove()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-if __name__ == '__main__':
|
|
|
-
|
|
|
- app.run(host='0.0.0.0', port=5010, debug=False, threaded=True)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+from sqlalchemy import true
|
|
|
+from app import create_app
|
|
|
+from flask import request
|
|
|
+from gevent import pywsgi
|
|
|
+
|
|
|
+
|
|
|
+app, db, mqtt = create_app()
|
|
|
+
|
|
|
+
|
|
|
+@mqtt.on_connect()
|
|
|
+def handle_connect(client, userdata, flags, rc):
|
|
|
+
|
|
|
+
|
|
|
+ mqtt.subscribe('AISKY/Coffee/MK-G/b8:27:eb:7e:24:78/Log')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+@mqtt.on_log()
|
|
|
+def handle_logging(client, userdata, level, buf):
|
|
|
+ print(client, userdata, level, buf)
|
|
|
+
|
|
|
+
|
|
|
+@app.teardown_appcontext
|
|
|
+def shutdown_session(exception=None):
|
|
|
+ db.session.remove()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+
|
|
|
+ app.run(host='0.0.0.0', port=5010, debug=True, threaded=True)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|