Más contenido relacionado
Similar a Snappy ubuntu+m2m labscharm (20)
Snappy ubuntu+m2m labscharm
- 2. © M2M labs creating a smart world
Contents
What we will do in the tutorial
What you need to start
The M2MLabs Charm
Define the Application
Snappy Ubuntu device
Look at the received data
- 3. © M2M labs creating a smart world
Overview
IoT
Devices
wireless
&
wireline
Snappy Ubuntu
M2MLabs
Framework Application
- 4. © M2M labs creating a smart world
What we will do in the Tutorial
Deploy the M2MLabs framework on Amazon Cloud
Deploy a sample application on a Snappy Ubuntu core system
Define the server part of the application on the M2MLabs framework
Start the application and watch it deliver data
Show the data on a graph
Run a sample device that transmits a set of random numbers
to a M2MLabs framework via REST HTTP calls. In the framework
the device is modeled and received device data is stored. An
application then queries the data and shows it on a graph.
- 5. © M2M labs creating a smart world
What you need to start
Juju Charms
Install Juju as shown in https://jujucharms.com/docs
Running on a public cloud like Amazon EC2 will require an account
on the cloud platform. Please configure Juju according to your cloud provider
(for Amazon follow the description in https://jujucharms.com/docs/config-aws)
Juju from Canonical allows to install full applications (called
Charms) on a cloud environment with just a few commands.
Snappy Ubuntu Tools
Build and remote deploy of Ubuntu Snappy applications
Install an Ubuntu core device or run it in the cloud as described in
https://developer.ubuntu.com/en/snappy
Install the Ubuntu snappy developer tools as described in
https://developer.ubuntu.com/en/snappy
- 6. © M2M labs creating a smart world
The M2MLabs Charm
juju bootstrap
creates the virtual machine running Ubuntu 14
juju deploy cs:~jim2308/trusty/m2mlabssimple1
installs the M2MLabs framework, please repeat juju status
until you get status “installed”. This will take 5-10 minutes.
juju expose m2mlabssimple
opens the port 8080 for the M2MLabs server
juju status
Gives you the public IP address of the M2MLabs server
Open <public ip address>:8080/cs-ws and create the
master apikey
The charm will install a complete
M2MLabs server including the
Apache Cassandra database
and the Glassfish application
Server on the cloud machine.
- 7. © M2M labs creating a smart world
Define the application
A sensor model with one attribute called temperature of type number
A device model with one sensor called tcore
Finally a device with any name
We need to create a sensor model, a device model and finally a
Device to receive data from our Snappy Ubuntu device.
In the M2MLabs Admin Gui create:
Instructions to use the Admin Gui can be found in
https://sourceforge.net/p/m2mlabs/wiki/Tutorial
- 8. © M2M labs creating a smart world
Snappy Ubuntu device
Download the sample code from
http://sourceforge.net/projects/m2mlabs/files/samples/samples.zip/download
Edit config.txt in samples/snapps/python-m2mlabs-sample/config
and change server url, apikey and device name to your settings
Run “snappy build .” in the samples/snapps/python-m2mlabs-sample directory
Run “snappy-remote –url=ssh://<dev-address> install ./python-m2mlabs-sample_0.1_all.snap”
to perform a remote download to the Ubuntu Core device. You will be asked three times for
the password of the user on your Ubuntu Core device. Please ignore any warnings and errors
during upload.
On the Ubunto Core device run python-m2mlabs-sample.m2mlabs-send
To deploy the Snappy Ubuntu application:
- 9. © M2M labs creating a smart world
Look at the received data
The device data panel of the Admin Gui shows the received data sent
from the Ubuntu Core device
- 10. © M2M labs creating a smart world
The live view graph
Finally we run a simple graph application that provides a live data view
by querying the M2MLabs framework via REST API on
<server-url>/cs-ws/monitor.html
- 11. © M2M labs creating a smart world
Thank you
https://sourceforge.net/p/m2mlabs/wiki/Tutorial
https://sourceforge.net/p/m2mlabs/wiki/Juju
https://sourceforge.net/p/m2mlabs/wiki/UbuntoCoreSample
Thank you
Please find further information on
or contact support@m2mlabs.com