Invoke a Node-RED flow on the Raspberry Pi from the Node-RED flow in Bluemix

You are now ready to pass commands and events to your Raspberry Pi. You use the Watson IoT Platform service for sending the information because it can communicate by using the MQTT protocol, which can be used to go through firewalls.

You will reuse the Node-RED environment that is also part of the boilerplate that you used in Lab 1.

  1. Import the following flow from GitHub to the Node-RED environment on Bluemix or use the copy of the default flow of the IoT Boilerplate starter that you created in Lab 1.
  2. Go to GitHub and click Raw.
  3. Copy all the raw code to your clipboard.
  4. In the Node-RED flow editor, create a new tab.
  5. Click the Menu icon > Import > Clipboard.
  6. Click the Send Data node to see the output in the debug pane on Node-RED.
    The data comes from the Device payload node. The function node that’s called Device payload generates random information (a temperature and a GPS location). You can see what is generated by using the debug node (the green Debug output payload node). Use the tab on the right side of the node to turn debugging output on and off.
  7. Configure the blue Send to RPi3 node in Node-RED on Bluemix. For Authentication, select Bluemix Service. Enter the device type and device ID that you created earlier. Then, click Done.