Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.



Expected completion time of this lab: 


10 min


  • The IBM Watson IoT platform acts as an MQTT broker: applications publish messages to it, others subscribe to messages.
  • Each MQTT message contains a topic, a string identifying the type of message. The following topics are examples of what is used by Watson IoT:

    iot-2/type/mote/id/00-17-0d-00-00-38-04-35/evt/oap.digital_in.D0/fmt/jsona "digital_in" OAP notification coming from mote 00-17-0d-00-00-38-04-35iot-2/type/mote/id/00-17-0d-00-00-60-4e-1f/evt/hr.Device/fmt/jsona device health report received from mote 00-17-0d-00-00-60-4e-1fiot-2/type/mote/id/00-17-0d-00-00-58-fe-43/evt/oap.temperature/fmt/jsona temperature measurements from mote 00-17-0d-00-00-58-fe-43
  • in Node-RED, you subscribe to messages through the ibmiot input node:
    Image Removed
  • by double-clicking on that node, you can configure the following (leave other fields untouched):

    Authenticationset to "API Key"API Key

    Functions like a username/password pair to authenticate to the Watson IoT Platform


    You instructor has already created a key. Ask for it.

    Input Typeset to "Device Event"Device Typeallows you to choose the type of device you want to subscribe to, in this lab either "manager" or "mote"Device Idunique identifier of the device, in this lab its MAC address, e.g. "00-17-0d-00-00-58-f5-23"EventThe type of event you want to subscribe to, e.g. "oap.temperature"start by creating the following flow in which you subscibe to all devices types, all device ids, all event types and all formats.
    Image Removedon your IBM Cloud-based Node-RED, instance, start a flow which subscribes to all events. 
  • make sure you see the messages appear in the debug tab
  • modify the flow by inserting a function node with the following code:

    Code Block
    var count = flow.get('count')||0;
    count += 1
    msg.payload = count;
    return msg;

  • What does the function above do?

    titleAnswer 1:

  • How many messages are published per minute to the Watson IoT platformbroker, on that topic?

    titleAnswer 2: