Can't connect my node-red with mqtt broker (mosquitto) on pi4

hello everyone i can't connect my node_red with mosquitto broker that i created in pi moreover i can't connect with mqtt explorer on the server anyone have any idea ???

Yup.

I think we need to know what you did to install Mosquitto in pi and whether Node-red and mqtt_explorer are on the same pi or a different machine.

on the same pi ofc

Still need this answered before anyone can help you.

i followed this

Hmm. I don't think I can help any further.

oh no problem thank you anyways

What does ofc mean

What does this command show?
sudo systemctl status mosquitto
Please copy/paste the result, not screenshot.

Here's a very basic Node-RED flow to help you check your MQTT setup on your Raspberry Pi-4.
basic_test_mqtt
Can you see if that will work in your setup.

This is what you should see in the debug node...
mqtt_result

[{"id":"27c4228b9d8246f0","type":"tab","label":"Basic_MQTT_test","disabled":false,"info":"","env":[]},{"id":"e0b777abd4ce3cb9","type":"inject","z":"27c4228b9d8246f0","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello world","payloadType":"str","x":180,"y":140,"wires":[["a5fe1e47fa208fe6"]]},{"id":"82029c324c9c4d88","type":"debug","z":"27c4228b9d8246f0","name":"debug 31","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":340,"y":200,"wires":[]},{"id":"447c2455ab506cbc","type":"mqtt in","z":"27c4228b9d8246f0","name":"","topic":"test","qos":"2","datatype":"auto-detect","broker":"fe4d4074.20ff58","nl":false,"rap":true,"rh":0,"inputs":0,"x":170,"y":200,"wires":[["82029c324c9c4d88"]]},{"id":"a5fe1e47fa208fe6","type":"mqtt out","z":"27c4228b9d8246f0","name":"","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"fe4d4074.20ff58","x":330,"y":140,"wires":[]},{"id":"a51bbe850ae556ce","type":"comment","z":"27c4228b9d8246f0","name":"Change the 'server' IP to match your setup","info":"","x":440,"y":100,"wires":[]},{"id":"fe4d4074.20ff58","type":"mqtt-broker","name":"RPi_156 server_Use_Me","broker":"192.168.1.156","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

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