4. 4
Sierra Wireless Device-to-Cloud Solution
Leading-edge
intelligent devices
+ Secure cloud
=
Value creation
services platform
& competitive barriers
5. Configuration
Software upgrade
Alert
Statistics
5
Eclo Inc. & their greenhouses
Corporate
software
sensor
Embedded
system
Support team
greenhouse
actuator
Customers
MQTT
REST API
Alert
Monitoring
Troubleshoot
Asset monitoring
6. 6
Example: Greenhouse project
MQTT
BeagleBone Black
Mobile/ Web App
Sensors
Actuators REST
API
7. 7
Bill of Material
• BeagleBone Black (and the USB cable)
• Ethernet cable
• Sensors and actuators (e.g. servomotor)
• AirVantage M2M Cloud account
Don’t have one?
Get an AirVantage Enterprise Platform trial account:
https://signup.airvantage.net/public/avep/
(Free for 6 months, up to 10 systems)
9. 9
Step 1:
Develop embedded code on BBB
Cloud9 IDE
Ethernet
cable
USB cable
sensors
10. Get the sample code : https://github.com/crystallam/beagleboneblack-mqtt-greenhouse
Customize the code and flash it to your BBB with the Cloud9 IDE
10
Embedded code
Purposes:
• Setup connection with
AirVantage
• Read the sensor inputs
• Send the data to AirVantage
• Listen to the command from
AirVantage
Test it on Cloud9
Keep sending data to AirVantage!
11. 11
Step 2:
Register your BBB on AirVantage
Go to Inventory tab/ Systems: register your BBB by creating a new system
12. 12
Create a system
System = “Gateway” (hardware) + “Subscription” (optional) + “Applications” (software)
Note your BBB serial number
and the MQTT password for the
embedded code
13. 13
Application model
Application model
- Describe the
Find an example in the tutorial “Using MQTT with AirVantage” :
https://doc.airvantage.net/display/USERGUIDE/Using+MQTT+with+AirVantage
capability of the
embedded
application
- Help AirVantage UI to
understand what are
the data and
commands sent by
the systems
14. 14
Publish it on AirVantage
Go to Develop tab/ My Apps and release your app to the repository
16. 16
Step 3:
Test it on AirVantage
Go to Monitor tab/ Systems, and click on your BBB to find this System detail page
17. 17
Timeline – troubleshoot
Troubleshoot with all the data sent from your device to AirVantage
18. 18
Data History – analyze data
Plot aggregated data on chart, identify trends
19. 19
Step 4:
Use API
First thing to do : create an API Client as the identifier of your application
20. 20
Implement authentication
AirVantage uses OAuth 2.0
• Pick the most suitable OAuth flow to get the
access token
– Resource owner for really trusted application
– Authorization code for server-side application
– Implicit for client-side application
Specs: http://tools.ietf.org/html/rfc6749
21. 21
AirVantage API
This is the typical format of our REST API
> GET https://{server}/api/v1/users/current?access_token={token}
Base URI : https://na.airvantage.net/api/v1
HTTP Verbs
GET: Used for retrieving resources.
POST: Used for creating resources, or performing custom actions.
PUT: Used for updating resources or collections.
DELETE: Used for deleting resources.
Resource Path : find them all in the API Documentation
Get an access token with OAuth 2.0
21
HTTP Verb Base URI Resource Path
22. 22
For the greenhouse project
I want to use the AirVantage API to
• get data sent from the greenhouses,
• automate communications,
• analyze the data
23. 23
Raw data
« I want to see the stream of values sent from my
device. »
API to list all historical values for a given data of a system
e.g. greenhouse.temperature:
> GET https://{server}/api/v1/systems/data/raw?
targetIds={system_uid}
&dataIds={data_id}
&access_token={token}
24. 24
Send commands & track operation
« I want my device to execute a command. »
API to send a command to given system. e.g. powerFan
> POST https://{server}/api/v1/operations/systems/command?access_token={token}
{
"systems" : {
"uids" : [“{system_uid}"]
},
"commandId" : “{command_id}"
}
25. 25
Send commands & track operation
« I want to validate the command has been received
and executed. »
API to get the details of an operation
> GET https://{server}/api/v1/operations/{operation_uid}?access_token={token}
26. 26
Send commands & track operation
« I want to validate the command has been received
and executed. »
API to get the details of an operation
> GET https://{server}/api/v1/operations/{operation_uid}?access_token={token}
• Track the "state" property to know if the operation is done
• Track the "state" property of the different "counters" to know if it
worked or not
27. 27
Alerts & Webhooks
« I want to be notified when the temperature is above a
threshold. »
Configure an alert rule
Setup the "Call URL" to enable webhook notifications
29. 29
Alerts & Webhooks
AirVantage will send a request on the callback URL as soon
as a new alert is generated
> POST http://www.yoursite.com/your_callback
{
"name":"event.alert.rule.triggered",
"date":1385718100163,
"content": {
"alert.uid":"f04a77e306de463e919ec39c387fa016",
"rule.uid":"7316ee643b17473381b61b8ac0afa824",
"target.uid":"da687e2c39d54bc391633fa9c8d4c0da"
}
}
30. 30
Aggregated data (System level)
« I want to analyze the data sent by my device.»
API to get aggregated values of data and multiple systems
> GET https://{server}/api/v1/systems/data/aggregated?
targetIds={system_uid1},{system_uid2}…
&dataIds={data_id1},{data_id2}…
&fn={aggregation_function}
&access_token={token}
Available functions:
mean, max, min, standard deviation, sum of squares, count, count of occurrences
e.g. get the average temperature of the greenhouses in Toulouse, Nice, Paris
31. 31
Aggregated data (Fleet level)
« I want to analyze the data sent by all my devices.»
API to get aggregated values for data of all the systems
> GET https://{server}/api/v1/systems/data/fleet?
targetIds={company_uid1}
&dataIds={data_id1},{data_id2}…
&fn={system_aggregation_function}
&fleetFn={fleet_aggregation_function}
&access_token={token}
e.g. get the maximum values of the average temperature of all my greenhouses
32. 32
Want to test the API now?
Try tools like Postman – www.getpostman.com
33. 33
What’s next?
Use the AirVantage API to get data with your favorite language
Check out sample web app “eclo watch”: https://github.com/AirVantage/sampleapp-eclo-watch
Data visualization
Dashboard
34. 34
The key steps again
Sensors
Actuators MQTT REST
API
Application
Step 1. Develop the
embedded code on
BBB
Step 2. Register BBB
on AirVantage to
receive data/ send
command
Step 3. Test it on
AirVantage
Step 4.
Create API client
Authenticate OAuth 2
Use APIs
35. 35
Explore the resources
• Get your free trial account: https://signup.airvantage.net/public/avep/
• To get started with AirVantage, check our the User Guide and Developer Guide:
https://doc.airvantage.net/
• Find the full list of the API in Develop/ API Documentation
• Check out http://airvantage.github.io/ for API libraries, projects and sample codes
• Tutorials mentioned:
– Connect your BBB to AirVantage using MQTT:
https://doc.airvantage.net/display/USERGUIDE/Using+MQTT+with+AirVantage
– Embedded code for BBB to send/receive sensor data to AirVantage:
https://github.com/crystallam/beagleboneblack-mqtt-greenhouse
– Web app example (“eclo watch): https://github.com/AirVantage/sampleapp-eclo-watch
• Need help?
– Forum: https://forum.sierrawireless.com/
– Feedback button on the web user interface @crystallam31
@airvantage
37. 37
House by Wayne Tyler Sall from The Noun Project
Thermostat by Luboš Volkov from The Noun Project
Fan by Arthur Shlain from The Noun Project
People by Berkay Sargın from The Noun Project
Cell Phone by Yorlmar Campos from The Noun Project
Router by im icons from The Noun Project
Circuit Board by Mike Wirth from The Noun Project
Credits
Editor's Notes
Share experience
SWIR is one of the sponsors
Purpose of this webinar
Who is Sierra Wireless
Leader in the wireless module market
AV M2M Cloud = AVMS + AVEP
Story of Eclo Inc
Who is Eclo Inc?
Problem 1: provide a new service to their customers
Solution 1: use AV to connect the greenhouse data to the customer app
Then they discover how easy it is to connect asset info, that they decide to develop other projects to connect the greenhouses’ data to their company’s backend and app for their support team
=> to improve their operations
(Connect your BBB to a PC and find this info from http://192.168.7.2/Support/BoneScript/getPlatform/)