We would like to know how to invoke an OpenWhisk action from IoT Platform in Bluemix. What we want to accomplish is:
Send an event data from a device to IoT Platform
Subscribe the event
Call an OpenWhisk action.
We are assuming the event data is JSON format. We know we can develop an application that subscribes to an event on the IoT Platform like: https://console.bluemix.net/docs/services/IoT/applications/libraries/java.html#java. However, we believe that there must be a more simpler way.
If we look at IoT Platform, we can create an action such as IFTTT, Webhook action, Forward event to cloud, etc. Generally speaking, which way do you recommend to invoke an OpenWhisk action from IoT Platform?
Any comments or suggestions must be appreciated. Thank you.
IBM Message Hub can automatically bridge messages between the Watson IoT platform and OpenWhisk.
Watson IoT service provides an integration to forward all incoming topics messages to IBM Message Hub. IBM Message Hub is an Apache Kafka-as-a-Service offering on IBM Bluemix.
Here are the instructions for connecting and configuring a historian service for the Watson IoT platform using IBM Message Hub.
https://console.bluemix.net/docs/services/IoT/message_hub.html#messagehub_main
OpenWhisk has a trigger feed service for IBM Message Hub. You can have triggers subscribe to messages from a Message Hub topic. Actions can then be bound to triggers to fire automatically for each event.
Here's an example walking you through connecting an OpenWhisk action to the Message Hub topic:
https://github.com/IBM/openwhisk-message-hub-trigger
Related
Good morning everyone,
I am currently working on a project which I use IBM Watson IoT Platform which will be linked with a Gateway,
Can I retrieve any parameter from the Gateway (ex: SSID, Password ...) and send it to the IBM Watson IoT Platform or I can only send an event triggered by the Gateway
Knowing that I use the MQTT protocol to send events to the IBM Watson IoT Platform
Command messages can be sent to gateways through the platform using MQTT to e.g. tell the gateway what data to send.
Code would have to be running on the gateway that listened for these commands and returned the information requested in the form of events (MQTT messages).
The sentence is simple and problem is well explained, after making a Node-Red application in IBM Watson and a sucefull Watson Iot Platform connection inside Node-Red inside IBM Iot Node i can not chose Bluemix Authentication as i supose to.
The Watson IoT nodes in Node-RED will only list 'Bluemix Authentication' if you have created an instance of the Watson IoT Platform service and you have connected the service to your application via the IBM Cloud dashboard.
If it cannot find any connected services, it will not provide that option and it will prompt you to provide a manually generated API Key.
To check the connection, log into https://cloud.ibm.com and navigate to your Node-RED application's dashboard page.
On that page click the 'connections' tab down the left-hand side.
On the connections page you should see a list of connected services. At a minimum you should see an instance of Cloudant. If your Watson IoT Platform service is not listed, click the 'Create connection' and select it from the list.
You should then restart your application (it should prompt you to do so automatically). Once it has restarted you should then have the Bluemix auth option available in the IBMIoT nodes.
We want to use a shared Bluemix org which contains a number of demo apps. Is there a way of detecting, which apps haven't been used (e.g few http requests) in order to stop inactive apps?
These cloud foundry docs state the following:
The Router emits RTR logs when it routes HTTP requests to the app. Router messages include the app name followed by a Router timestamp and then selections from the HTTP request.
You should get an idea of how many requests your apps are receiving by looking for RTR log entries.
Manually, you could check the console logs using the cf logs .. command, or by visiting the log page in the Bluemix console.
You could automate the check using the cloud foundry tools or using the cloud foundry apis to parse the applications logs.
https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html#rtr
I explored on sending data from Device to Cloud using Azure REST Apis. It is working seamlessly without any issues. I'm not finding good articles on sending Cloud-to-Device messages to Arduino board using "Azure IoT Hub REST Apis". Could some one provide suggestions on this
You could also send the request as the azure portal does it. All C2D from AZ Portal are sent through this Endpoint https://main.iothub.ext.azure.com/api/Service/SendMessage/ and the payload is a json that look like this:
{
"hostName": "iothub-hostname",
"owner": "twinUpdate",
"key": "key for the iothub",
"deviceID": "your device on that hub",
"body": "{\"test\": \"This is a test over postman\"}",
"properties": "[]"
}
Keep in mind that you need to add an Authorization Header with valid Bearer token. You can get this when you log in to AZ Portal.
As Peter Pan said, there isn't a RESTful API for send C2D messages currently. However, you still have some other chooses.
Use Azure Function App. You can create a HTTP trigger Azure Function App to use as RESTful proxy, and run IoT Hub SDK on Azure Function App to send C2D messages.
Use AMQP over WebSockets with 443 port if you cannot use 5671 port for AMQP to connect to IoT Hub on your service side. We have developed a web based IoT Hub devtool based on Rhea, and you can reference our code.
According to the offical document Send and receive messages with IoT Hub, and after I reviewed the source codes of Azure IoT Hub for sending cloud-to-device message using different languages, there is no REST API to support on sending Cloud-to-Device messages. To send c2d message from application to Azure IoT Hub, the recommended protocol is AMQP and the simple way is using Azure IoT Hub SDK. That you can refer to the section Communication protocol, as below.
However, if you want to receive the c2d message from Arduino, you can refer to the section Cloud-to-device messages and use the REST API Receive Device Bound Notification on Arduino.
IF support where can i find detail documentation about REST api.
Thanks
THanks for the reply and Update information about release version of service bus. i manage to sucessfully connect to the service bus and get the authentication token using following microsoft examples.
http://msdn.microsoft.com/en-us/library/windowsazure/jj193003%28v=azure.10%29.aspx
Once u get the token rest of operation (create que, send messages, recive messages) are same as windows azure service bus. please see the detail about microsoft documentation about service bus operation.
http://msdn.microsoft.com/en-us/library/windowsazure/hh690927.aspx
hope this helpful.
THanks.
The protocol surface between Server and Service is largely symmetric, albeit there are different ports for some sub-services and the authentication model has been adapted for a Server environment using a local STS instead of ACS. You will find updated MSDN documentation beyond what's currently available as part of the SDK as we ship the release version of Service Bus Server, which will happen before this month is over.