Raspberry Pi 2 Sensor

Dear Community
I installed Ubunut Mate on my Pi i love that distru it works really fine,
i overclocked that thing.
So here is my question i would like to see the temprature in my bar,
when i add the little widget it tells me sensors not found so the sensor isnt added to this, but when i use the cat /sys/class/thermal/thermal_zone0/temp command the sensor tells me the temp.
so dear community how can i add the sensor to my littlele applet/widget.
_nCo

I also had the same question. This must not be that hard. :disappointed_relieved:

You could add the Command applet to the panel to execute the command for retrieving the value of the temperature.

After you right-click the applet and enter the properties, you can set the command and the interval (I suggest 10, 30 or 60 to avoid overloading it)

cat /sys/class/thermal/thermal_zone0/temp

It’ll then display the temperature as the output of that command. Not as pretty as the Sensors applet with the icon, but it should work. :smile:

Thank you. It worked.
Is there a way to divide by 1000?

It’s a bit tricky piping the output to perform maths, but you can create a script instead… plus add the °C or °F symbol.

#!/bin/bash
Temp=$(cat /sys/class/thermal/thermal_zone0/temp)
echo $(( $Temp / 1000))"°C"

Simply copy and paste this into a new text document, save it as something.sh, mark it as executable (Right Click → Permissions tab) and then update the Command applet to point to your script, eg: /home/pi/temperature.sh

It can be done easier within a single command line like:

awk '{printf "%3.1f°C\n", $1/1000}' /sys/class/thermal/thermal_zone0/temp

This will display the right temperature value divided by 1000. If you do not need the unit, just the value itself, simpy omit the “°C” in the “printf” statement :wink:

Alternatively, use the following command:

vcgencmd measure_temp

This will display the command output in the following format:

temp=25.6'C

Hope this helps :+1:

1 Like