Can´t connect to Node Red as Client

Hello everyone,
i created a little Raspberry Pi Node-Red Setup according to some videos and the basic steps from the webpage. Right now everything seems fine. I Installed Mosquttio and created the first mqtt in -> msg.playload out. . I can connect to the Web Interface via Browser from my PC and the MQTT In Button signals "connectet".

So first Test would be a simple "Hello World" message. But i can´t connect the Raspberry PI Broker via any other Client. I am Using MQTTBOX on my PC and MQTTDash on my Android Phone. All got no connection. I disabled the Firewall, changed the router, installt / startet from 0 with node-red at least 4 times. Nothing.

Where / what could the Problem be? Any Input helps :slight_smile:

Welcome to the forum.

What version of mosquito did you install? You can find out using the command
apt policy mosquitto
Or if that doesn't work
apt-cache policy mosquitto

Do you have a flow like this, does it work?

[{"id":"27dc528e6536a991","type":"inject","z":"5664307bd8383bfd","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello World","payloadType":"str","x":470,"y":100,"wires":[["850a3353b5a6e8d1"]]},{"id":"47cca5c8c4027c2f","type":"mqtt in","z":"5664307bd8383bfd","name":"","topic":"test","qos":"2","datatype":"auto","broker":"d675b749.04b9c8","nl":false,"rap":true,"rh":0,"x":770,"y":100,"wires":[["47315a995734cddd"]]},{"id":"850a3353b5a6e8d1","type":"mqtt out","z":"5664307bd8383bfd","name":"","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d675b749.04b9c8","x":610,"y":100,"wires":[]},{"id":"47315a995734cddd","type":"debug","z":"5664307bd8383bfd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":100,"wires":[]},{"id":"d675b749.04b9c8","type":"mqtt-broker","name":"Localhost","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

Hey, thanks for the reply.

Installed: 2.0.11-0mosquitto1~buster1
Candidate: 2.0.11-0mosquitto1~buster1

Flow is allready there:

and the Settings from MQTTBOX

But you don't have any way in that flow to inject "Hello world" and thus prove that Node-Red and Mosquitto are working together before involving another app.

ah ok, as far as i have seen it in the "how to" clips from youtube, i just have to puplish to the topic of my choice. in my case /test

Does it work without the leading / ?

flow itself is working

i think the main problem is, that i cant establish the connection from any other divice than the rapsberry itself.

With mosquito V2 if you want to access the broker from a different machine then you have allow that in the mosquito config file. That has been addressed several times here so a search should find it.

I have never used MQTBox so I don't know if it is set up correctly.
Are Node-Red and Mosquitto on a Raspberry Pi?
What computer has MQTTBox on it?
Are they both connected to the same network? How - both Wifi, both Ethernet or a mix?

Oh! didn't know that! But I currently use Aedes raher than Mosquitto.

I recommend using mosquitto.

1 Like

Sorry, I din´t find it here in the forum. Maybe i chosed the wrong wording. But Google is a friend :slight_smile:
I dont know exactly why, but the trick is to creat an user account...or so it seems. just googling till it works ^^

For the others with the same problem :slight_smile:

  1. creat config file
    sudo nano /etc/mosquitto/conf.d/010-listener-with-users.conf

insert this in the file:
listener 1883
password_file /etc/mosquitto/conf.d/010-access-list
allow_anonymous false

  1. create accounts - to do so, create another file:
    sudo nano /etc/mosquitto/conf.d/010-access-list
    add users as text (username is the name, and password the password :wink: ):

3)sudo mosquitto_passwd -U /etc/mosquitto/conf.d/010-access-list

i dont know exactly what the last part did...but the magic website told me to do it.

Reboot and it worked.

sorry, not my work so here is the Link:

Thanks Colin, that was the input i needet :slight_smile:

Also, as mentioned earlier, don't start a topic with a leading /

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.