Sorry I’m quite new to Python and I just used
python mqtt-all.py
in the examples folder.
I just run the example script you mentioned and got a Connection Refused error:
python3 mqtt-all.py --broker 192.168.0.25 --topic enviro
mqtt-all.py - Reads Enviro plus data and sends over mqtt.
broker: 192.168.0.25
client_id: raspi-0000000098c21c23
port: 1883
topic: enviro
Press Ctrl+C to exit!
Traceback (most recent call last):
File “mqtt-all.py”, line 238, in
main()
File “mqtt-all.py”, line 190, in main
mqtt_client.connect(args.broker, port=args.port)
File “/usr/local/lib/python3.7/dist-packages/paho_mqtt-1.5.1-py3.7.egg/paho/mqtt/client.py”, line 941, in connect
return self.reconnect()
File “/usr/local/lib/python3.7/dist-packages/paho_mqtt-1.5.1-py3.7.egg/paho/mqtt/client.py”, line 1075, in reconnect
sock = self._create_socket_connection()
File “/usr/local/lib/python3.7/dist-packages/paho_mqtt-1.5.1-py3.7.egg/paho/mqtt/client.py”, line 3546, in _create_socket_connection
return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
File “/usr/lib/python3.7/socket.py”, line 727, in create_connection
raise err
File “/usr/lib/python3.7/socket.py”, line 716, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused