I'm quite new to node red and just tried to get a MQTT connection running without success. I entered the ip address and username/password and a topic as well. However, after deploying there's no "connected"-indicator below the MQTT node and it doesn't receive any values.
When I enter the same information in MQTT fx, everything works fine.
I tried this with 2 MQTT-servers (running on raspis).
Do you have any ideas what I could try?
Node red version is 1.2.9. Here's some additional info. I don't really know what it means, but it was asked for in a simular topic and might be helpful.
Are you using the latest version of node-red (1.2.9)? I think there were some issues with MQTT a little while ago that have been fixed. It may not be the problem here but worth upgrading first just in case.
It is odd that the status is not showing at all.
If you put the wrong credentials in, or put the wrong server address in, do you see a status shown then?
Stop node red, then start it in a terminal and post the resulting output here, that might tell us something.
I entered: mosquitto_sub -h 192.168.178.25 -t /Test -u openhabian -P mypassword
and then nothing happened (got in the next line, but nothing at the beginning and I couldn't enter any more commands). Then i restarted the terminal. <-- this is probably irrelevant.
However, when I looked in node red again, there suddenly was a connection. And strangely, the connection with mqtt fx was interrupted:
You probably have the same Client ID in the two connections. You must not have two connections with the same client ID as the server assumes the ids are unique and that if a client connects again then the old connection should be dumped (this could happen if the client were roaming for example, so the connection moves from one network to another).
You can leave it blank in node-red and it will make up an id for you.
Yes, the Client IDs were identical and now it works.
I still don't now why it didn't connect in the beginning, but if the problem won't appear again, that's fine with me
Thank you for your quick and very helpful replies!
It might have been a browser caching issue, or something like that. It was not that it wasn't connecting, but that it didn't show any status at all that is unusual and makes me suspect something like that.
The reason that mosquitto_sub would not connect is probably because you did not provide the credentials with it.