intergrated everything and added simple endpoint for mqtt data

This commit is contained in:
2024-11-05 17:06:07 +01:00
parent 7424c2d033
commit 9cdf9aa44d
2 changed files with 10 additions and 1 deletions

View File

@@ -23,6 +23,13 @@ def move():
mqtt_client.publish("home/commands", direction) # Het topic kan aangepast worden
return jsonify({"status": "success", "direction": direction})
# Run the Flask application in debug mode
@app.route('/data', methods=['GET'])
def data():
data = mqtt_client.subscribe("kobuki/data")
if data:
return jsonify({data})
if __name__ == '__main__':
app.run(debug=True)