4. Send commands to the candle

    1. Open the flow editor for your Bluemix instance of Node-RED.
    2. Drag an inject node onto the canvas.
    3. Drag a function node onto the canvas.
    4. Drag an output ibmiot node onto the canvas.

      You should have these three nodes:
    5. Change the function node name to SetColorRed and add the following code to set the color to red:

      var newmsg = {"cmd" : "setcolor",
      "mode":"",
      "speed":"",
      "rr" : 255,
      "gg" : 0,
      "bb" : 0
      }
      msg.payload=newmsg ;
      return msg;

    6. Click Done to save your changes to the function
    7. Configure the ibmiot (IBM IoT) out node with the following information:
    8. Click Done to save your changes.
    9. Wire the nodes together.
    10. Click Deploy to deploy your new flow.The IBM IoT node should show a status of connected.
    11. Click the inject tab to initiate the flow.

      The color on the candle should change to red.You can import additional flows to control your candle from GitHub:

      https://raw.githubusercontent.com/markusvankempen/playbulb/master/node-red-flows/pbcandle1b.flow

 

Summary

Now that you’ve configured your devices, you now can control a PLAYBULB Candle from your Bluemix Node-RED application.