I am trying to configure a Raspberry Pi (Raspbian, Jessie) to send temperature data from a DS18B20 sensor to my MQTT broker.
I have installed mosquitto, mosquitto-cl
As mentioned in the comment, the code you posted does work, but for publishing a single message this form is better
#!/usr/bin/env python import paho.mqtt.publish as publish publish.single("test/test", "Hello world!", hostname="192.168.0.21")