TEMPer (Temperature sensor 413d:2107) on Linux

Software builded and deployed on Fedora 28

There are several expensive solution to monitor room temperature, rely on cloud solutions or maybe you need to pick up the soldering iron. There is an alternative on the market that comes cheap: The TEMPer device. It can be bought from Ebay or big known e-commerce websites like dx.com. I bought my TEMPer devices  from Ebay for 8,58 USD each.

To be able to successfully deploy a TEMPer device you need to have a little knowledge how to compile C code and Linux. To monitor properly the room temperature you want to use an USB extension cord.

The sellers I bought the hardware from are:



Step 1: Look up the device USB ID

There are several TEMPer devices sold as the same. They all do the same job, however be aware that the USB ID’s are different. Currently the 413:2107 is being sold and does not work out of the box with code to be found on the internet. Since I’m having the 413:2107 I’ll explaining how to make it work. I do not have the other versions. USB ID’s can be found with:

$ lsusb

If it is correct, there will be a rule containing this: Bus 006 Device 003: ID 413d:2107 , to be sure we also verify this with dmesg. You will find the following rules:

$ dmesg
input: HID 413d:2107 as /devices/pci0000:00/0000:00:10.0/usb6/6-2/6-2:1.0/0003:413D:2107.0003/input/input13
hid-generic 0003:413D:2107.0003: input,hidraw1: USB HID v1.11 Keyboard [HID 413d:2107] on usb-0000:00:10.0-2/input0
hid-generic 0003:413D:2107.0004: hiddev97,hidraw2: USB HID v1.10 Device [HID 413d:2107] on usb-0000:00:10.0-2/input1

If both are verified we are good to go and know that Linux recognizes the TEMPer device.


Step 2: Get the developer Distro packages needed to compile the TEMPer software

$ sudo dnf install hidapi-devel bc

Step 3: Git clone the needed software

$ sudo -i
$ cd /opt/
$ git clone https://github.com/edorfaus/TEMPered
$ cd TEMPered
$ cmake .
$ cd /opt/TEMPered/utils
$ make
$ cp hid-query /usr/local/bin


Step 4: Find out which hidraw device is our TEMpered device by trying to get metrics out of it:

$ ./hid-query /dev/hidraw1 0x01 0x80 0x33 0x01 0x00 0x00 0x00 0x0
No data was read from the device (timeout).

./hid-query /dev/hidraw2 0x01 0x80 0x33 0x01 0x00 0x00 0x00 0x00
Device /dev/hidraw2 : 413d:2107 interface 1 : (null) (null)

Writing data (9 bytes):

00 01 80 33   01 00 00 00 00

Response from device (8 bytes):

80 80 0a 21   4e 20 00 00


Our TEMPered device is allocated at /dev/hidraw2


Step 5: Create TEMPered script

$ vi TEMPered

OUTLINE=`/usr/local/bin/hid-query /dev/hidraw2 0x01 0x80 0x33 0x01 0x00 0x00 0x00 0x00|grep -A1 ^Response|tail -1`
OUTNUM=`echo $OUTLINE|sed -e ‘s/^[^0-9a-f]*[0-9a-f][0-9a-f] [0-9a-f][0-9a-f] \([0-9a-f][0-9a-f]\) \([0-9a-f][0-9a-f]\) .*$/0x\1\2/’`
DVAL=$(( 16#$HEX4 ))
CTEMP=$(bc <<< “scale=2; $DVAL/100”)
echo $CTEMP

$ chmod +x TEMPered


Test the script:

$ ./TEMPered


This is ‘all’ it takes to make it working. I tested the TEMPered sensor next to an analogue temperature sensor and the values matched. Unfortunately this script needs to be executed as root.

Leave a Reply

Your email address will not be published. Required fields are marked *