Is it possible to read the CPU temperature on an Intel-nuc running HassOS?

I’ve migrated from Supervised Ubuntu to HassOS. I know, jumping the gun slightly. Just thought I’d get it over and done with, it was pretty painless.

Have got everything working with the exception of reading the CPU temp of the nuc.

I previously had this sensor:

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

But this doesn’t work under HassOS.

When I run:

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

In terminal/ssh I get:

cat: can’t open ‘/sys/class/thermal/thermal_zone*/temp’: No such file or directory

Does anyone know a workaround? Thanks for any help :+1:

Here’s mine:

- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone2/temp"
  unit_of_measurement: "°F"
  scan_interval: 240
  value_template: " {{ (( value | multiply(0.0018)) + 32 ) | round (1) }}"
1 Like

This is the mine, running on Proxmox (debian based). I assume that you might need to install the “sensors” app, on Ubuntu, through apt-get.

sensor:
  - platform: ssh
    host: !secret proxmox_host
    name: 'NUC CPU Temp'
    username: !secret proxmox_user
    password: !secret proxmox_pass
    command: "sensors | grep 'Package id 0:' | cut -c17-20"
    value_template: >-
      {%- set line = value.split("\r\n") -%}
      {{ line[1] }}
    unit_of_measurement: '°C'
2 Likes

Thanks guys, but I don’t have a Supervised install on the nuc. I’m not running Debian or Ubuntu. I’m running HassOS.

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

Doesn’t work, as described in my original message.

So am I and the solution I posted above works for me.

Oh! @tom_l, in terminal/ssh what do get if you enter:

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

I’ve also tried:

cat /sys/class/thermal/thermal_zone0/temp
cat /sys/class/thermal/thermal_zone1/temp
2, 3, 4

I always get:

cat: can’t open ‘/sys/class/thermal/thermal_zone*/temp’: No such file or directory

The examples I posted above are from my system. I have zones 0, 1 and 2.

So, presumably you have used the thermal_zone2 element and set your sensor as : -

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

For Centigrade.
Or for Farenheit, follow Mark’s example above

It seems, from obesrvation (please correct me if I’m wrong, but the posts I’ve read seem to agree) that Pi’s use zone 0 and Intel’s use zone 2 ???
I’ve also noticed that : -

  value_template: "{{ '%.1f' | format(value / 1000) }}"

Does NOT work at all, strange !
:thinking:
Maybe the filter to multipy() implicitly makes it a number

1 Like
 _    _                                         _     _              _   
| |  | |                          /\           (_)   | |            | |  
| |__| | ___  _ __ ___   ___     /  \   ___ ___ _ ___| |_ __ _ _ __ | |_ 
|  __  |/ _ \| '_ ` _ \ / _ \   / /\ \ / __/ __| / __| __/ _` | '_ \| __|
| |  | | (_) | | | | | |  __/  / ____ \\__ \__ \ \__ \ || (_| | | | | |_ 
|_|  |_|\___/|_| |_| |_|\___| /_/    \_\___/___/_|___/\__\__,_|_| |_|\__|
                                                                         
Welcome on Home Assistant command line.

For more details use 'help' and 'exit' to close.
If you need access to host system use 'login'.

ha > login
# cd /sys/class/thermal/
# ls
cooling_device0  cooling_device1  cooling_device2  cooling_device3
# cat /sys/class/thermal/cooling_device*/type
Processor
Processor
Processor
Processor
# cd /sys/class/thermal/cooling_device2/
# ls
cur_state  device     max_state  power      subsystem  type       uevent
# 

I don’t have any “thermal_zone” in /sys/class/thermal/ only “cooling_device” and these don’t list a temperature.

FWIW, this is a screenshot from my test system running Home Assistant 0.110.0 on an RPI3 (installed from disk-image; meaning it uses HassOS).
Screenshot from 2020-05-24 11-21-57

It contains just one thermal zone and no cooling zones.

Out of curiosity, is your RPI cooled passively or actively (i.e. does it have a fan)? My RPI3 is passively cooled (Flirc case).

Hey, it’s an Intel-nuc, not an RPI and it’s passively cooled.

This one: https://www.jetwaycomputer.com/JBC311U93.html

Issue is very similar to this thread: CPU Temperature for quad core CPU

Perhaps that explains the differences between what you are seeing and what people are suggesting you use.

Thanks @123, but @tom_l is using a nuc and it’s working for him. So don’t think that’s the problem. Maybe a BIOS setting? Or a hardware quirk?

The link describes the product as “Intel NUC form factor”. Is it truly a clone of an Intel NUC in all aspects? The fact you don’t see thermal_zone, whereas other Intel NUC owners do, suggests there are subtle differences.

@123 I completely agree that there’s probably a difference. It’s strange that this previously worked when my install was Supervised on Ubuntu.

I am running HassOS in a VirtualBox VM on an Intel NUC running Windows 10 Pro and the sensors don’t exist. I only see cooling_zone0 and cooling_zone1 directories with no data files representing any kind of temperature. The NUC CPU is actively cooled. It has a fan.

Did anyone find the solution to this?

Open Hardware Monitor on the Windows HostPC:

I will take a look at that.

I just did a sneaky edit ofmy post because I wasn’t sure Glances could run on Windows. It can. Though OHW would probably be easier.

1 Like