Fidel
(Paulo Teixeira)
November 11, 2018, 8:58pm
1
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
aidbish
(Adrian)
November 11, 2018, 9:01pm
2
Look at the glances component
website for glances, has install instructions
https://nicolargo.github.io/glances/
Fidel
(Paulo Teixeira)
November 11, 2018, 9:25pm
4
Netdata sounds promising. If not I’ll check glances.
Thank you
silvrr
November 11, 2018, 10:28pm
5
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.
Fidel
(Paulo Teixeira)
November 11, 2018, 10:43pm
6
That’s what I was trying. Can you explain how to do it?
Fidel
(Paulo Teixeira)
November 11, 2018, 11:12pm
8
Are you running it on RaspberryPi?
That only work with RaspberryPi.
finity
November 11, 2018, 11:40pm
9
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) }}'
Fidel
(Paulo Teixeira)
November 12, 2018, 12:02pm
11
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
silvrr
November 12, 2018, 12:44pm
12
How did you install?
Again if on a non Hassio install try:
cat /sys/class/thermal/thermal_zone*/temp
Fidel
(Paulo Teixeira)
November 12, 2018, 2:06pm
13
When I got home I’ll try.
Fidel
(Paulo Teixeira)
November 12, 2018, 5:07pm
14
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°
Fidel
(Paulo Teixeira)
November 13, 2018, 7:33pm
15
Finaly done.
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
bukurat
(John)
March 14, 2019, 6:30am
16
$ cat /sys/devices/virtual/thermal/thermal_zone?/temp
will list the contents of the temp files in all the thermal zones.
yoni3210
(yoni mo)
April 26, 2019, 6:17am
17
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