How to show the Raspberry Pi CPU temperature?

I measure mine in this way:

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

  - platform: command_line
    name: GPU Temp
    command: "/opt/vc/bin/vcgencmd measure_temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | regex_findall_index("=([0-9]*\.[0-9]*)", 0) }}'

  - platform: command_line
    name: CPU Clock
    command: "/opt/vc/bin/vcgencmd measure_clock arm"
    unit_of_measurement: "MHz"
    value_template: '{{ value | regex_findall_index("=([0-9]*)", 0) | multiply(0.000001) | round(0) }}'
5 Likes