Skip to content

Instantly share code, notes, and snippets.

@bphermansson
Last active August 15, 2019 08:48
Show Gist options
  • Save bphermansson/a201c8a40832d5f00997522146885363 to your computer and use it in GitHub Desktop.
Save bphermansson/a201c8a40832d5f00997522146885363 to your computer and use it in GitHub Desktop.
Simple Python script that just publish a message to a MQTT-broker
import sys
import paho.mqtt.publish as publish
publish.single("mqttjs", "Hello from mqttjs", hostname="192.168.1.190")
// If using web sockets:
publish.single("mqttjs", "Hello from mqttjs", hostname="192.168.1.190", port=9001, transport='websockets')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment