Community
OpenEnergyMonitor

Community

MQTT "Error: Connection refused"

mqtt
mqttbroker
Tags: #<Tag:0x00007f1fe468b928> #<Tag:0x00007f1fe468b798>

(Zeeuk) #1

Hello Guys,

I run in some trouble and I hope you willo be able to help me.

I’m following https://www.youtube.com/watch?v=AsDHEDbyLfg
"How-To Get Started with Mosquitto MQTT Broker on a Raspberry Pi" videoand I have some issue with command “sudo mosquitto_sub -d -u mosquitto -P mypassword -t “dev/test”” i’m getting “Error: Connection refused”

I did some googling and if I run command “mosquitto -d” before any other command it starts working but that doesn’t make any sense for me and also if raspberry will be restarted it will stop working again :confused:

Thanks
Zee


(Paul) #2

mosquitto -d

Is used to start the mosquitto daemon from the command line (much like sudo service mosquitto start) so it sounds like you just need to enable the mosquitto service to start at boot time. Try this command

sudo systemctl enable mosquitto.service

(Zeeuk) #3

sorry but still doesn’t work :confused:


(Scott Shannon) #4

Did you ever get it working without the need for the mosquitto -d command? I’m having the same issue.


(fido) #5

I tried ~$ sudo systemctl enable mosquitto.service, but this didn’t correct the error message “Error: Connection refused”.
However, ~ $ mosquitto -d worked.
Thank you zeeuk for your post.


(Ironator) #6

Had the same problem. Solved it simply by deleting the log-file. It was created new and my demon accepts connections.