HA CPU temps

Hi guys,

So I’m running my home assistant in a dedicated server (Ubuntu server 18.04), and I’m trying to make the CPU temps showing on HA.
I searched on the web but only found how to do it in RPi.
Spent all day trying, but no luck.

Can some one help me?

Thanks
Paulo aka Fidel

Look at the glances component

website for glances, has install instructions
https://nicolargo.github.io/glances/

Or netdata.

1 Like

Netdata sounds promising. If not I’ll check glances.

Thank you

Are you running Hassio did you install in a virtual environment?

If the latter you can run a command line sensor and pull the data that way.

That’s what I was trying. Can you explain how to do it?

4 Likes

Are you running it on RaspberryPi?
That only work with RaspberryPi.

use this:

- 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) }}'

I am running on a NUC with debian and it works perfectly

EDIT: Sorry, @silvrr, I didn’t see you posted the same thing.

2 Likes

Thanks for this! I needed F and couldn’t figure out how to output it with the command so I adjusted the template to:

value_template: '{{ (((value * 0.001) * 9/5) + 32) | round(0) }}'

I will try, but pretty sure it won’t do.
When I do: cat /sys/class/thermal/thermal_zone0/temp at the command line nothing happen.

Thanks

How did you install?

Again if on a non Hassio install try:

cat /sys/class/thermal/thermal_zone*/temp

When I got home I’ll try.

This is what I got:

paulo@paulo_server:~$ cat /sys/class/thermal/thermal_zone*/temp
cat: '/sys/class/thermal/thermal_zone*/temp': No such file or directory

This is the only way to get only the CPU temp Value, nothing else. That I found.

root@paulo_server:/home/paulo#  /usr/bin/sensors | grep "CPU Temperature" | cut -c18-28
    +35.0°

Finaly done.

image

image

Here is the code if someone need:

- platform: command_line
    name: CPU Server
    command: "sensors | grep 'CPU Temperature' | awk '{ print $3 }'"
    value_template: '{{ value | multiply(0.1) | round(1) }}'

Thanks to anyone that spent some time to help me.

2 Likes

$ cat /sys/devices/virtual/thermal/thermal_zone?/temp

will list the contents of the temp files in all the thermal zones.

Hi,

I’m running on a virtual machine Ubuntu 18.10 , tried without success, did you install anything on Ubuntu?
trying to show temps on hassio

1 Like

If running Hassio on a NUC, what is the proper way to get CPU temp? Using the Hassio command line or the host?

try this:

paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'

then this:


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

4 Likes

The command gives the following result:

cat: /sys/class/thermal/thermal_zone2/temp: No data available
acpitz 27.8°C
acpitz 29.8°C
iwlwifi 52.0°C
x86_pkg_t.e°C