Node red and mqtt on ibm cloud (bluemix)?

#1

Is it possible to use node red and mqtt on a bluemix instance without using the ibm "Managed devices" framework/environment?

I am trying to set up a flow like this to send arbitraty messages but can't get the mqtt nodes to work. I think I am not understanding the URL security settings and several apikey/authtokens in IBM dashboards/app/services/connections.

[{"id":"6789aac7.ae4fb4","type":"inject","z":"fb19899.5845a78","name":"","topic":"hello","payload":"this is the msg","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":140,"wires":[["fb6272af.4b74c","a649b47d.668408"]]},{"id":"fb6272af.4b74c","type":"mqtt out","z":"fb19899.5845a78","name":"mqtt hello","topic":"hello","qos":"","retain":"","broker":"f98794d8.8d00c8","x":540,"y":140,"wires":[]},{"id":"eaca990c.d96658","type":"debug","z":"fb19899.5845a78","name":"Msg Received by MQTT Node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":430,"y":300,"wires":[]},{"id":"a649b47d.668408","type":"debug","z":"fb19899.5845a78","name":"Attempted Send to MQTT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":410,"y":220,"wires":[]},{"id":"768d5d50.a63994","type":"mqtt in","z":"fb19899.5845a78","name":"","topic":"hello/#","qos":"0","broker":"f98794d8.8d00c8","x":150,"y":280,"wires":[["eaca990c.d96658"]]},{"id":"f98794d8.8d00c8","type":"mqtt-broker","z":"","name":"MyMqtt","broker":"6ykzkv.messaging.internetofthings.ibmcloud.com","port":"8883","tls":"","clientid":"a:6ykzkv:1","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Almost all the docs I find talk about it from the "managed device" (IBM framework) perspective, so before I plow further into it, I'm asking if what I'm trying to do is even possible.

Thanks,
John

0 Likes

#2

Are you asking if you can use NR & Bluemix with your own MQTT broker? If so, the answer is yes - that's what I'm doing using Mosquitto on my network. I assume your current code is using Watson IOT, which I have not used.

0 Likes

#3

Thanks, but no, I am wanting to connect clients to the mqtt broker which is running on (my instance of) bluemix. (e.g. 6xyZzy.messaging.internetofthings.ibmcloud.com:1883 )
And then send/receive messages on arbitrary topics like topic="greet msg"="hello world" (NOT the IBM-device-managed format like topic="iot-2/type/myDeviceType/id/myDeviceID/cmd/command/fmt/text").

I will post also on developer.ibm.com...

0 Likes

#4

No, you cannot use the IoT Platform as a generic mqtt broker. You need to register your devices and follow the topic name requirements of the platform.

0 Likes

#5

Hmm, I was afraid of that. Thanks.

0 Likes

#6

you can run your own broker of course - either via a separate machine - eg a softlayer instance - or inside Node-RED using https://www.npmjs.com/package/node-red-contrib-mqtt-broker - but you'll have to ensure you secure it yourself of course.

0 Likes