pytemper: Read USB TEMPer in Python

2008-11-27 17:49 - Programming

Based partially on the C program from Tollef Fog Heen, which I described my discovery of a few weeks back, but mostly on reverse engineering from the software included with the device, I now have a Python script capable of reading temperatures from the USB TEMPer device.

My intent is to build the thermostat system I've been talking about in Python. Removing the requirement to repeatedly shell out to a C executable is quite nice. You can download the raw source (MOVED, see below). It relies on pySerial to control the serial port. Right now I've just got what appear to be TEMPer "v2" devices, so that is all it's expected to work with at the moment.

Comments:

Buggy!
2008-11-24 18:03 - arantius

After running this code for a while, I've found that it's buggy -- it will spike to wrong values occasionally. I over simplified, and cut out too many things that seemed nonessential. I'll work over this more carefully and report back!

Fixed
2008-11-27 17:50 - arantius

I've uploaded new source, which I've been using for the past few days, and appears to be working just fine.

Three comments
2008-12-03 22:00 - Mike Pfirrmann
  1. The link to "download the raw source" points to http://arantius.com/misc/oytemper.py when it should point to http://arantius.com/misc/pytemper.py.

  2. While creating an account and logging in, JavaScript is used to change the value of the password field from my password to an encrypted version of my password. It is the encrypted version of my password that Firefox wants to save and use as my unencrypted password on subsequent logins.

  3. Though I do not own a USB TEMPer with which to test it, the program looks pretty cool. And your python code looks a lot nicer than that C gobbledygook.

Moved!
2008-12-08 18:36 - arantius

I've moved this to be a real project, see its new home page at:

http://trac.arantius.com/wiki/Projects/PyTemper

This comes with a bug fix -- I found out the strange subtraction of 2048 in the original source is important, when the temperature fell drastically last night.

pytemper + windows
2011-07-04 07:30 - neulos

I assume that this script works with the new TEMPER (HID devices) and Linux. Has anyone managed to make it work under windows. Any hints on how to do it (if possible)?

Not even a single example of how to use it?
2012-07-21 21:49 - Ann

When I try, I get

 SerialException: could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'

lsusb says

 Bus 002 Device 006: ID 0c45:7401 Microdia

Post a comment:

Username
Password
  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.
Subject:
Comment:

You may use Markdown syntax in the comment, but no HTML. Hints:

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)