How to show the Raspberry Pi CPU temperature?


System monitor shows the cpu temperature for RPi? I don’t see it under configuration variables.


No system monitor does not include CPU temperature. Use this sensor:

- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | multiply(0.001) | round(1) }}'

And for the GPU:

- platform: command_line
  name: GPU Temperature
  command: "/opt/vc/bin/vcgencmd measure_temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | replace("temp=", "") | replace("''C", "") }}'


On my system (Raspbian Release 9.6, Kernel version: 4.14) I do not have this command…


Any time I use the degree symbol in my yaml, like:

unit_of_measurement: “°C”

I get an error:

Error loading /config/configuration.yaml: ‘utf-8’ codec can’t decode byte 0xb0 in position 2830: invalid start byte

It works fine if I leave that line out.


Try using different quotes. Single quotes work, also note the difference between your double quotes and the ones below.

unit_of_measurement: '°C'

unit_of_measurement: "°C"


I tried both kinds of quotes, no difference. The double quotes only looked wrong here in the forum because I quoted the line instead of using a code block like I should have.

I also verified that I’m using ASCII character decimal 176, xB0.

If I delete just that one character, the config checks OK. If I re-add it, I get the error again. I’ve already moved on, not worth worrying about. I used legit’s method of displaying in F, which works fine.


Use notepad++ and make sure the format of the file is UTF8… Sometimes it changes to western or something like that…


Bingo!! Changed it to UTF8 and no more errors. Thanks!!!


Yeah that error is a bastard to track down.


Any reason you don’t do this within the customise section in GUI?


Do what specifically?


To set a unit of measurement:


It works for HassOS.