This is Part 1 of 3 in the Up and Running with Xively on Python with xiPy Series
Before we dive in, you need to have a Xively account to use this tutorial. It's quick and simple to get one. Just submit a quick application at Xively.com.
This tutorial assumes that you've got a working version of Python 2 or 3 installed and
virtualenv. If you haven't already, you can install virtualenv with
apt-get install python-virtualenv.
Before we get going, the first thing we need to make sure is that we've got the xiPy library installed in our environment and that we're able to import from it. Activate your environment and install xiPy direct from the GitHub repo using
$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip...done.
$ source venv/bin/activate
$ pip install git+https://github.com/xively/xiPy.git
Cloning https://github.com/xively/xiPy.git to /tmp/pip-gEWatc-build
Running setup.py (path:/tmp/pip-gEWatc-build/setup.py) egg_info for package from git+https://github.com/xively/xiPy.git
Installing collected packages: xiPy
Running setup.py install for xiPy
Successfully installed xiPy
So far, so good.
Let's make sure we're able to import. Create a new Python script with the following content, and save it as xively.py.
from xiPy.xively_connection_parameters import XivelyConnectionParameters
from xiPy.xively_client import XivelyClient
from xiPy.xively_error_codes import XivelyErrorCodes
print ('[SUCCESS] xiPy library imported')
(venv) $ python xively.py
[SUCCESS] xiPy library imported
In Part 2 of the Up and Running with Xively on Python with xiPy Series we'll create our new IoT device in the Xively control panel and connect it to the MQTT broker. In Part 3 we'll subscribe to a Xively Topic and start sending commands to our IoT device. In Part 4 we'll start emitting simple notifications from our device. Part 5 will cover how to send time-series data to Xively. In the end we'll throw together a lightweight front-end to control the device, and build an information radiator you can use to wow your PM.