Hello,
I am new to Bluemix and may have not still understood all the logic.
I have registered a device and can send MQTT messages from it to Bluemix. On NodeRed running on https://myappname.eu-gb.mybluemix.net and configured with Input IBM IoT connected to output debug, I can see my messages. I was expecting to see the same with input mqtt configured with
server = myorgid.messaging.internetofthings.ibmcloud.com
port = 1883 or 8883
topic = the topic I used to push
client id = blank
security username = blank or use-token-auth
security password = blank or token
But unfortunately, I do see nothing in the output debug connected to this input mqtt.
I tried to subscribe to my messages with mosquitto_sub using the same config, but here also I do not receive anything.
Where am I wrong?
Thanks in advance for your support.
Are you supplying the user name and password or leaving it blank?
Per the MQTT connectivity for devices IoT platform documentation, the user name is the same value for all devices: use-token-auth
The device's authentication token is specified as the password. The password for each device is the unique authentication token that was generated when the device was registered with Watson IoT Platform
Answer by idani (624) | Jan 04, 2017 at 12:08 AM
Hi Sideralis, you cannot subscribe subscribe to a topic using (use-token-auth) authentication mechanism, you have to go into the IoT Platform dashboard, generate a API-key and API-token the use them to authenticate and subscribe to the events (topic) published by the device. You can find more details about this here:
https://console.ng.bluemix.net/docs/services/IoT/applications/mqtt.html
As a note, a device can only subscribe to a command topic.
Hope it helps!
Daniel
Answer by Sideralis (1) | Jan 04, 2017 at 01:52 AM
Thanks for your answers.
With port 8883, I was supplying use-token-auth and my token as username and password.Are you supplying the user name and password or leaving it blank?
Now, where I am not fully clear with all your explanations is:
As I want to subscribe to a topic from NodeRed running in my BlueMix application, should I follow:
MQTT connection for applications
or
MQTT connection for devices
And regarding this sentence:
How is, the link between the event I sent and the command I want to subscribe, made?As a note, a device can only subscribe to a command topic.
Does it mean that I need to push a command?
Anyway, I will do some more tries with the help of the documentation provided. Thanks for that.
Port 8883 is for SSL secure connections, even using port 1883 you would need to authenticate and not leave your auth info blank.
If you are using Node-RED you can connect as an application or as a device, but if you connect as a device you can only subscribe to commands and not events.
If your goal is to read events, then you should do as Daniel suggested and connect as an application with API key and token. Your application can then use logic to publish a command should you wish to have a device subscribe to commands based on the event information your application receives.
How to communicate to beagle bone black using watson iot platform? 1 Answer
Can't connect Raspberry Pi using TLS with Client Certificate and Token to Watson IoT Platform? 1 Answer
IoT Authorization Error 7 Answers
How do you configure dynamic device ID and device type in Watson IoT Platform I/O node? 2 Answers
Connecting IoT App and Service to Raspberry Pi GPIO 1 Answer