node-red / cookbook.nodered.org

Node-RED Cookbook
http://cookbook.nodered.org
Apache License 2.0
84 stars 34 forks source link

Feedback on 'Connect to an MQTT Broker' #87

Closed spikkster closed 3 years ago

spikkster commented 3 years ago

Hello! After a lot of trying, i send You my issue... Config: Linux Mint , mosquitto broker/server runs on port 1883 as service, Node-Red runs on port 1880 started in a command line window. No other signifficant apps running on the same machine. Mosquitto runs with default settings, no SSL/TLS, no user and pass required. On the listener cmd line window i can sign up for a topic: mosquitto_sub -h 192.168.1.23 -k 60 -p 1883 -t teszt then i can send message: mosquitto_pub -h localhost -p 1883 -t teszt -m message It works. I can connect with my phone using an MQTT app and receive/send messages.

But in Node-Red, when i make an MQTT in or out node, and set the same broker, nodes does not connect any way.

The node-red window says the next messages on all Deploys:

ReferenceError: URL is not defined at Object.connect (/usr/local/lib/node_modules/node-red/node_modules/mqtt/lib/connect/index.js:64:18) at MQTTBrokerNode.connect (/usr/local/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js:245:40) at MQTTBrokerNode.register (/usr/local/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js:221:22) at new MQTTOutNode (/usr/local/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js:504:29) at Object.createNode (/usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:493:31) at Flow.start (/usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:194:48) at start (/usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:345:33) at stop.then.then (/usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:210:21) at at process._tickCallback (internal/process/next_tick.js:188:7)

Can you help me? Thanks! Spikk

knolleary commented 3 years ago

This issue list is for feedback on the recipes in the cookbook.

For general support please use the forum: https://discourse.nodered.org

Make sure you include what version of node-red and node.js you are using. It would also be help to share how exactly you have configured the broker node - either a screenshot or export the MQTT In node (Using the Export option from the main menu) and share the JSON on the forum.