reorginisatie

This commit is contained in:
2024-10-23 14:18:36 +02:00
parent 5b2570dace
commit 481ae4f2c3
4 changed files with 0 additions and 31 deletions

View File

@@ -1,31 +0,0 @@
from flask import Flask
from flask_mqtt import Mqtt
app = Flask(__name__)
# MQTT configuratie
app.config['MQTT_BROKER_URL'] = '145.109.226.204'
app.config['MQTT_BROKER_PORT'] = 1883
app.config['MQTT_USERNAME'] = 'ishak'
app.config['MQTT_PASSWORD'] = 'kobuki'
app.config['MQTT_KEEPALIVE'] = 60
app.config['MQTT_TLS_ENABLED'] = False # TLS uitschakelen indien niet nodig
mqtt = Mqtt(app)
# Callback voor wanneer de verbinding tot stand komt
@mqtt.on_connect()
def handle_connect(client, userdata, flags, rc):
print(f"Connected with result code {rc}")
mqtt.subscribe("move")
# Callback voor wanneer een bericht binnenkomt
@mqtt.on_message()
def handle_mqtt_message(client, userdata, message):
command = message.payload.decode()
print(f"Received command: {command}")
# Voeg hier je code toe om het commando uit te voeren
# Start de Flask applicatie
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)