I am using Raspberry Pi 3 and testing another solution. I am moving to fitPC with Quad Core CPU.
On my Raspberry Pi, I use the following to monitor the CPU Temperature:
- platform: command_line
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
# If errors occur, remove degree symbol below
unit_of_measurement: "°F"
value_template: '{{ (value | multiply(0.001) * 1.8 + 32) | round(1) }}'
The problem with my new fitPC is that there is no /sys/class/thermal/thermal_zone0/temp.
I have this:
user@HomeAssistant:~$ ls /sys/class/thermal/
cooling_device0 cooling_device1 cooling_device2 cooling_device3
user@HomeAssistant:~$
How can I measure and display the temperature for the quad core CPU? Anyone knows? The system thinks there are four CPUs, so maybe it will be four different temp sensors display?
Good suggestion, thank you but there is no temp file under any of cooling_device*:
user@HomeAssistant:~$ ls /sys/class/thermal/cooling_device0
cur_state device max_state power subsystem type uevent
user@HomeAssistant:~$ ls /sys/class/thermal/cooling_device1
cur_state device max_state power subsystem type uevent
user@HomeAssistant:~$ ls /sys/class/thermal/cooling_device2
cur_state device max_state power subsystem type uevent
user@HomeAssistant:~$ ls /sys/class/thermal/cooling_device3
cur_state device max_state power subsystem type uevent
user@HomeAssistant:~$
You don’t say whether you installed HA on the base system or using the docker version.
Note that some of those sensors could be for the GPU and other devices, not just the CPU. You can find out which one by: cat /sys/class/thermal/cooling_deviceX/type
But after that, I don’t know… However, if you are using HA on a base system, then you could install lm_sensors (apt-get install lm_sensors), then from command line run: sensors -f
Note that it may return something like acpitz-virtual-0, that’s probably your CPU. Then you could filter out the results using a shell script and save it to a text file to read in. If you are continually monitoring the temp, then you can turn your shell script into a cron job.
Also, if using the docker version, you may not see “sensors” from it, you will need to run a command line to include it into the docker, which I never done.
If you did sensors -f, at least one should show up as CPU, etc. In my case, it comes up as acpitz-virtual-0 (while others refer to the GPU, etc) and I have /sys/devices/virtual/hwmon/hwmon0/temp1_input. Note that “virtual” is common, so it is the CPU temp.
As far as the others, I’m not sure, but could be hard drives and other devices that have sensors.
If you want to monitor the temps as they change, from the command line type in watch -d sensors -f
then compare with results with your HA command_line sensor.
If you want to use the same path as before, you can just create a link to /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon1/temp1_input with the same name you expected, make the destination direcory first, i.e.:
Interesting. After making some changes and rebooting this device a few times, I noticed that it does not show the temperature anymore. When I check, the location changed.
It was:
/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon1/temp1_input
and now it is:
/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon0/temp1_input
The folder name changed from hwmon1 to hwmon0. I guess this path will not work for me if I have to double check and change it in configuration file every time I restart my device.