Expected completion time of this lab:
. |
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/json |
---|
a "digital_in" OAP notification coming from mote 00-17-0d-00-00-38-04-35 |
iot-2/type/mote/id/00-17-0d-00-00-60-4e-1f/evt/hr.Device/fmt/json |
a device health report received from mote 00-17-0d-00-00-60-4e-1f |
iot-2/type/mote/id/00-17-0d-00-00-58-fe-43/evt/oap.temperature/fmt/json |
a temperature measurements from mote 00-17-0d-00-00-58-fe-43 |
by double-clicking on that node, you can configure the following (leave other fields untouched):
Authentication | set to "API Key" | |
API Key | Functions like a username/password pair to authenticate to the Watson IoT Platform
| |
Input Type | set to "Device Event" | |
Device Type | allows you to choose the type of device you want to subscribe to, in this lab either "manager" or "mote" | |
Device Id | unique identifier of the device, in this lab its MAC address, e.g. "00-17-0d-00-00-58-f5-23" | |
Event | The type of event you want to subscribe to, e.g. "oap.temperature" |
modify the flow by inserting a function node with the following code:
var count = flow.get('count')||0; count += 1 flow.set('count',count); msg.payload = count; return msg; |
What does the function above do?
How many messages are published per minute to the Watson IoT platform?
Registering to all events is not good practice. Instead, you should register only to exactly what data you need. Make sure you erase your flow before moving on to the next lab. |