Menu

UbuntoCoreSample

Jim

Ubuntu Core Device

This is a sample project that runs on an Ubuntu Core device, for more information or Ubuntu Core please look at https://developer.ubuntu.com/en/snappy. The sample code is written in Python and creates a random number every 5 seconds n times and sends it to the m2mlabs server.

Prepare Snappy Tools

Loading a snappy app to an Ubuntu Core device requires installation of the snappy tools on an Ubuntu 14 system.

  • sudo add-apt-repository ppa:snappy-dev/beta
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install snappy-tools bzr

Install the Sample

  • download the sample code from http://sourceforge.net/projects/m2mlabs/files/samples/samples.zip/download
  • create a device with sensor name "tcore" and attribute name "temperature" in the m2mlabs admin GUI. How to create device models, sensor models and devices is described in the Tutorial
  • edit config.txt in samples/snapps/python-m2mlabs-sample/config and change server url, apikey and device name to your settings
  • install Python on the Ubuntu Core device if it is not already installed
  • execute "snappy build ." in the samples/snapps/python-m2mlabs-sample directory
  • execute "snappy-remote --url=ssh://<address-of-your-ubuntu-core-device> 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
  • you can change the config data on the Ubunto Core device with "sudo vi /apps/python-m2mlabs-sample/current/config/config.txt"
  • on the Ubunto Core device execute python-m2mlabs-sample.m2mlabs-send
  • check if data was received on the m2mlabs admin GUI at http://localhost/cs-ws:8080 or run the monitor at http://localhost/cs-ws:8080/monitor.html. The usage of the monitor is described in the Monitor Tutorial

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.