Raspberry PI - get temperatur

1 post / 0 new
#1 Sat, 2016-03-26 06:16
roger.newman
  • roger.newman's picture
  • Offline
  • Last seen: 1 year 11 months ago
  • Joined: 2016-03-26

Hi everyone,

as there is no vcgencmd in alpine, I was looking for a way to get the temperature of my rpi.
So here is a simple alias to get a well formated output of the current temp. Put it in you .bashrc or .zshrc and reload it.

alias

## get temperature
function temp() { awk "BEGIN { printf \"%.2f°C\\n\", $(cat /sys/class/thermal/thermal_zone*/temp)/1000 }" }

output

46.16°C


edit:
The pkg raspberrypi provides the pi-tools so /opt/vc/bin/vcgencmd measure_temp will do the job.


Regards,

Roger Newman