My Account

Wish List (0)

Saved Carts

Compare

Approved Re-Seller
Follow us on Facebook! Follow us on Twitter! Follow us on Instagram!

How to Use the TEMPer USB Sensors

August 03, 2017

The TEMPer USB sensors are super easy to get setup on your Raspberry Pi thanks to a python library available on GitHub. https://github.com/padelt/temper-python

Start by installing the required packages:

sudo apt-get install python-usb python-setuptools

Once that’s installed you can proceed to clone the git to your Pi

cd ~
git clone git://github.com/padelt/temper-python.git

Once you have downloaded the repository you have two methods of using it:

  1. Through a simple temper-poll script
  2. Writing your own python script

To install the temper-poll script simply cd to the downloaded repository

cd temper-python

Then run the setup script

sudo python setup.py install

Once that is done, you can simply use the following command to get the temperature and humidity from the sensor

temper-poll

If you want to take things further and write your own script! Within the temper-python directory you will find another directory called temperusb, move into this dir.

cd temperusb

In here you will notice a couple of scripts, we are interested in the cli.py and temper.py scripts.

temper.py is the actual library so we don’t need to edit that one, we just need to make sure we have a copy of it in the same directory as our own script.

cli.py is a good example to base our script off of.

Start by running the cli.py script and see what happens

sudo python cli.py

As you’ll see it produces the same result as the temper-poll script.

If you get this error:

ValueError: Attempted relative import in non-package

Edit the script and change this line

from .temper import TemperHandler
to
from temper import TemperHandler

From here you can copy the cli.py script and edit it to suit your needs!

Last update: August 03, 2017

Comments

Leave a Comment

Leave a Reply

* Name:
* Comment:
* E-mail: (Not Published)
Website: (Site url with http://)
Verification code: