This repository is an Node-RED application to simulate events from virtual appliances of the openfridge sample application. With this Node-RED application you do not need to use the Paho or Mosquitto MQTT client for simulating events from the virtual devices, you can just do it from a web application.
It can be deployed into Bluemix with only a couple of clicks, using a Bluemix DevOps Toolchain
Follow the instructions provided at :
- Set up the Bluemix services (Cloudant, SendGrid, Watson IoT, and a Cloud Foundry app).
- Set up the OpenWhisk actions, triggers, and rules.
2- Once the openfridge sample Application deployed - update records for each device in the CLOUDANT_APPLIANCE_DATABASE database of the Openfridge application
For each device you need to add a deviceId
attribute wich contains the device ID of the appliance (as defined on the IBM IoT platform)
{
"_id": "aaaabbbbcccc",
"deviceId": "1",
"serial": "aaaabbbbcccc",
"warranty_expiration": 1467259200,
"owner_name": "Vincent Cailly",
"owner_email": "[email protected]",
"owner_phone": "18885551212"
}
Important: the email address specified here will be eventually used to receive email notifications by the OpenWhisk actions - make sure it is valid.
From the bluemix console or using the Bluemix CLI, create an instance of the Cloudant
service, and call it sample-node-red-cloudantNoSQLDB
. This is where your Node-RED
instance will store its data.
Remark: If you want to change the name of this Cloudant instance, you must update manifest.yml
accordingly.
You can easily deploy into bluemix by clicking on the following button.
When you click the button, you are taken to Bluemix where you get a pick a name for your application at which point the platform takes over, grabs the code from this repository and gets it deployed.
When you first access the application, you'll be asked to set some security options to ensure your flow editor remains secure from unauthorised access.
Important: Do not check the option to enable Application Metrics for Node.js
Once the Openfridge UI
application deployed into bluemix you need to configure the cloudant IN
an the 3 MQTT OUT
nodes with your own settings (server and credentials parameters for authentication to the cloudand and IoT platform services)
1 - Open the cloudant IN
node
2 - Click the Edit button of the Server
attribute
3 - Fill the fields with the credentials for the CLOUDANT_APPLIANCE_DATABASE
database of the Openfridge application. Then click on UPDATE
and then DONE
.
1 - Open the MQTT OUT
node
2 - Click the Edit button of the Server
attribute
3 - On the Connection
Tab, Replace <orgid> by the value of your IBM IoT Platform Organization ID
4 - On the Security Tab
-
Fill the Username Fiels field with the use-token-auth value (Authentication to the IBM IoT platform with a Tokeb)
-
Fill the Password field with the TOKEN of the Device (That you have set on the IBM IoT platform). Then click on
UPDATE
and thenDONE
.
The Node-Red flow editor is accessible at : http://<bluemix_app_name>.mybluemix.net/red/
The "Openfridge UI" Application is accessible at :http://<bluemix_app_name>.mybluemix.net/ui/