mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
made print to see if message is sent correctly
This commit is contained in:
@@ -8,7 +8,6 @@ mqtt_client = mqtt.Client()
|
|||||||
# Verbinding maken met de Raspberry Pi (broker)
|
# Verbinding maken met de Raspberry Pi (broker)
|
||||||
mqtt_client.username_pw_set("ishak", "kobuki")
|
mqtt_client.username_pw_set("ishak", "kobuki")
|
||||||
mqtt_client.connect("ishakpi.ddns.net", 1883, 60)
|
mqtt_client.connect("ishakpi.ddns.net", 1883, 60)
|
||||||
client = mqtt.Client(protocol=mqtt.MQTTv311)
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
@@ -16,8 +15,12 @@ def index():
|
|||||||
|
|
||||||
@app.route('/move', methods=['POST'])
|
@app.route('/move', methods=['POST'])
|
||||||
def move():
|
def move():
|
||||||
mqtt_client.publish("home/commands", "Knop ingedrukt!")
|
result = mqtt_client.publish("home/commands", "Knop ingedrukt!")
|
||||||
return "Bericht verzonden!"
|
if result.rc == mqtt.MQTT_ERR_SUCCESS:
|
||||||
|
print("Bericht succesvol gepubliceerd")
|
||||||
|
else:
|
||||||
|
print("Fout bij het publiceren van bericht")
|
||||||
|
return "Bericht verzonden!"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
Reference in New Issue
Block a user