Raspian/Debian Thermometer


Today’s post is about using the TEMPerV2:


My version reports as:

Bus 001 Device 004: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
Bus 001 Device 005: ID 413d:2107
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I am currently using this with Raspbian in conjunction with a Zabbix server. Installing is as follows:

sudo apt-get install libhidapi-dev libhidapi-hidraw0 cmake git
git clone https://github.com/edorfaus/TEMPered.git

TEMPered/libtempered/temper_type.c needs modifying to work with this device, details be found here.

cd TEMPered 
mkdir build
cd build
cmake ..
sudo make install

On Raspbian/Debian the libs need to copied to another location, before TEMPered works as intended:

sudo cp /usr/local/lib/libtempered* /usr/lib/

TEMPered should now be working as intended, for example:

pi@pitemp:~ $ sudo tempered
/dev/hidraw1 0: temperature 26.56 °C


If you are using Zabbix:


like me then you can install zappix-agent

apt-get install zabbix-agent

And add the following to the bottom of: /etc/zabbix/zabbix_agentd.conf

UserParameter=cluster1.roomTemperature,tempered | grep -oP '(?<=/dev/hidraw1 0: temperature) [\d.]+'

Then restart Zabbix-agent:

systemctl restart zabbix-agent

Then add to your Zabbix  Server as an host item and Zabbix agent type.

SNMP (Not tested, but should work)

If your are using Nagios or PRTG, or if prefer SNMP can also use if it with Zabbix; advanced knowledge of SNMP is presumed:

And add the following to the bottom of:  /etc/snmp/snmpd.conf

pass . /bin/sh /usr/local/bin/snmp-cpu-temp


if [ "$1" = "-g" ]
echo .
echo gauge
tempered | grep -oP '(?<=/dev/hidraw1 0: temperature) [\d.]+'
exit 0

Key: gauge


Edit 10/11/19 – /dev/hidraw1 needs to accessible by non root users.  This should be done with a udev rule, but I couldn’t get this this to work; if any has an answer to this please comment below. Anyway so I fudged it by adding /bin/chmod 666 /dev/hidraw1 to rc.local. On distos running systemd, a systemd unit will probably need to be created and enabled; I won’t advise how to that here as a google search will give results pretty quickly.


If you don’ want to use a network monitor server you could just set a cronjob to check the temperature and send an email alert if temperature is to high, for example:

sudo crontab -e
*/15 * * * * /bin/bash /home/pi/check-temp.sh

This will check the temperature every 15 minutes and send an alert if required.


a=$(/usr/local/bin/tempered | grep -oP '(?<=/dev/hidraw1 0: temperature) [\d.]+')
export a
if [ $a \> $b ];
python /home/pi/alert.py
echo "Temperature" $a"c, normal";
sleep 10
unset a b

Will call /home/pi/alert.py and send alert if temperature is over 40 °c (to change this update b= ).


# import necessary packages

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
import os

# create message object instance
msg = MIMEMultipart()

message = os.environ.get('a')

# setup the parameters of the message
password = "password"
msg['From'] = "email@example.com"
msg['To'] = "email@example.com"
msg['Subject'] = "Temperature Alert! Value in body is in Centigrade" 

# add in the message body
msg.attach(MIMEText(message, 'plain'))

#create server
server = smtplib.SMTP('mailserver.example.com: 25')


# Login Credentials for sending the mail
server.login(msg['From'], password)

# send the message via the server.
server.sendmail(msg['From'], msg['To'], msg.as_string())

print "successfully sent email to %s:" % (msg['To'])

Thanks Tom.

P.S Please feel free to comment.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.