Commit 98ddb1ca by Jan-Piet Mens

notification/mqtt: ensure network communication and check error

parent 2a091a35
......@@ -119,6 +119,9 @@ def publish(module, topic, payload, server='localhost', port='1883', qos='0',
module.fail_json(msg="unable to connect to MQTT broker")
mqttc.publish(topic, payload, int(qos), retain)
rc = mqttc.loop()
if rc != 0:
module.fail_json(msg="unable to send to MQTT broker")
mqttc.disconnect()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment