The IBM Cloud (Bluemix) Connection node provides a connection to a configured instance of an IBM Cloud Internet of Things Platform for device data collection in the IBM Cloud. When configured, the node will upload any incoming messages to the IBM Cloud.
Each Mobius node or gateway must be manually added to your IBM Cloud Internet of Things Platform. To do this, first, create a Gateway Type and name it Mobius_Node, then create a gateway device of this new type. All devices associated with this gateway are added automatically when data is sent to the IBM Cloud Internet of Things Platform. For further information on how to set this up, see Connect EnOcean Switch to IBM Cloud (Bluemix).
The node has three properties to configure. The properties configuration window is shown below.
The Org property is organisation ID of the configured IBM Cloud IoT Platform. This is provided by IBM when you create and configure your IBM Cloud IoT Platform.
The organisation ID can be found in the top right of the IBM IoT Platform page. This is outlined by the red box in the window below.
This is the ID of the gateway object created in the IBM IoT Cloud. This is set when creating your IBM Cloud IoT Platform. This normally matches the Hub ID of the Mobius node (see MobiusFlow Architecture).
The red box in the window below outlines where the Gateway ID can be found on the IBM IoT Cloud Platform page.
This is the authentication token of the gateway object created in the IBM IoT Cloud platform. This is set when creating the gateway object within the IBM IoT Cloud. The authorisation token exists for security reasons. It is 18 characters long and can either be specified by the user or automatically generated.
After the gateway object is created in the IBM IoT Cloud platform, all credentials are presented. These are outlined in the red boxes below.
Please note, it is not possible to retrieve the authentication token from the IBM IoT Cloud if it is lost, so make a note of it when you create your gateway object within the IBM IoT Cloud.
If configured correctly, the IBM IoT Connection node connects to the device within the IBM Cloud. The node will show connected status as seen below.
Furthermore, the connection status can be seen by viewing the device within the IBM Cloud platform. This outlined in red below.
When connection is made, the node will output a message containing the storeFwdControl (msg.storeFwdControl) property. The property will be set to 'True' causing any connected Store and Forward nodes to enter forwarding mode. A typical setup with a Store and Forward node is shown in the diagram below. For more information on the Store and Forward node Mobius Cloud Format & Store and Forward Nodes.
If the node loses connection, a message will be outputted with the storeFwdControl parameter set to false. This will send the Mobius Store and Forward node into store mode until such a time connection is reestablished.
Setting up the Device within IBM Cloud
Initially, a new IoT resource must be created. When on the IBM Cloud home Dashboard, the 'Create resource' button is used to create new resources. This is shown in red below.
Within the catalog menu, the 'Internet of Things' option should be selected. This is shown in red below. The 'Internet of Things Platform' tile should then be selected to create a new IoT Platform. This is shown in orange below.
The Platform creation wizard prompts the user to enter several fields of information. Once entered, the 'Create' button can be clicked confirming the creation of the new IoT platform. This is outlined in red below.
The new IoT platform can then be found using the search bar outlined in red below. Once the new IoT platform has been selected within the list, the new IoT platform can be launched using the 'Launch' button shown in orange below.
Within the new IoT platform, a new device type must be created. This new device type will represent the Mobius gateway type within the IBM platform. The 'Devices Types' tab must be selected within the main menu, shown in red below. The 'Add Device Type' button can then be clicked to add the new device type. This is outlined in orange below.
Within the device type creation wizard ensure the type is set to 'Gateway' instead of 'Device'. Important note, the name must be set to 'Mobius_Node'. These properties are shown in the red box below. The 'Next' button should then be used to proceed with the wizard. This is shown in orange below.
The creation wizard gives further configurable properties. These are not important to the connectivity of the device type so they can be left as the default values. The finish button, shown in red below, can then be clicked to confirm the creation of the new device type.
Next, a device instance representing the active Mobius hub must be created within the IBM IoT platform using the new device type previously created. The browse tab, shown in red below, should be navigated to. The 'Add Device' button can then be clicked to begin adding the new device. This is shown in orange below.
Within the device creation wizard, ensure the Device Type is set to the 'Mobius_Node' device type previously created. The Device ID is nominally set to equal the Hub ID of the active Mobius Hub (000001 in this example). These properties are shown in the red box below. The next button can then be clicked to proceed with the creation of the device. This is shown in orange below.
The creation wizard takes the user through several pages of configurable properties. These are not important for the connectivity of the node and therefore can be left as the default values. When the device creation is completed, the device credentials are presented to the user. These are seen in the red box below. Important note, the Authentication Token is only presented once here and on no further instances of viewing the device. Ensure this token has been recorded.
The following flow is generated. The flow uses several nodes without explanation. The articles containing more information on the function and usage of these nodes are listed below.
- Set Resource node - See Mobius Core
- Mobius Flow Inject node - See Mobius Core node-RED Nodes
- Mobius Cloud Format - See Mobius Cloud Format & Store and Forward Nodes
- Store and Forward - See Mobius Cloud Format & Store and Forward Nodes
The IBM IoT Connection node is configured for use with the properties presented at the end of the previous section. Note, the node shows the connection status to show it has successfully connected to the device within the IBM IoT Cloud.
The two inject nodes, labeled 15 and 16, inject messages to the set resource node which changes the temperature resource (URI - 000001/020/0034/0001/40) of the temperature sensor to 15 or 16 degrees respectively. The inject nodes are set to inject data every few seconds, simulating a sensor with constantly changing reading.
The Mobius Flow Inject node is subscribed to changes in the Temperature/Humidity device, so it sends a message whenever the temperature reading changes. The message then passes through the Mobius Cloud Format and change nodes. These nodes prepare the data to be uploaded into the IBM IoT Cloud.
Finally, the data is relayed by the Store and Forward node to the IBM Cloud Connection node ready for upload. The output is fed back into the Store and Forward node to automatically stop the node from forwarding if the connection to the IBM Cloud is lost.
The flow is deployed and the inject nodes begin sending continuous data to simulate a constantly changing temperature reading. This uploads a continuous temperature data stream to the IBM IoT Cloud. Viewing the previously set up gateway within the IBM IoT Cloud platform shows the data has been received. This is shown below. The update in temperature reading is outlined in the red box. Note, the IBM IoT Cloud automatically creates the instance of the device which is then populated with data from Mobius.