Displaying Cpu Temperature Within Home Assistant

isnt this function(get CPU temp) already covered by System Monitor Component?

typical isnt it lol i didnt see that and now i’ve looked then yes pretty much that covers what i was trying to do !

Thanks again for all your help. theres so much to learn and it feels like im going to need much more than just a few months to pick up this lot !

Ah, I totally forgot about them - the cpu sensor didn’t suit my chip type, I think that’s why I forgot.

Sorry for going around the houses with it jammin36 !

@Bit-River
I followed your instructions, and added the sensor as below, and changed ‘°C’ to ‘°F’, but the temp is still displaying in Celsius.

Any ideas?

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

This works for me to covert to Fahrenheit:

value_template: '{{ (value | multiply(0.001)) | multiply(1.8) + 32 | round(1) }}'

Thank you.

I tried that, and got the following.

“CPU Temperature
37 seconds ago
136.39280000000002 º”

# CPU temperature
- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: 'ยบF'
  value_template: '{{ (value | multiply(0.001)) | multiply(1.8) + 32 | round(1) }}'

This should fix the rounding error:

value_template: '{{ (value | multiply(0.001) * 1.8 + 32) | round(1) }}'

Thank you.

That did it.

"CPU Temperature
53 seconds ago
128.6 F?

Hi,

My sensor.cpu_temperature reads unknown. I tried both double and single quotes and cat /sys/class/thermal/thermal_zone0/temp reads the temperature. Here is the configuration.yaml entry:

sensor 14:
  - 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) }}'

Try 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) * 1.8 + 32) | round(1) }}'

Thanks for the response.

The only difference looks like the lack of degrees symbol “°” in unit_of_measurement and the Fahrenheit conversion. I tried removing degrees symbol, which didn’t work. Sometime yesterday, I noticed that although no value is displayed, the temperatures were properly plotted in the graph. Later the graph was empty, too.

I just copied what I’m using, which works for me.

This is what I’m using:

- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "F"
  value_template: '{{ (value | multiply(0.001) * 1.8 + 32) | round(1) }}'

Entity ID:
sensor.cpu_temperature

And this is the out put:

The log record is: Command failed: cat /sys/class/thermal/thermal_zone0/temp

I checked the same command also in the virtual environment where I’m running hass and it’s OK. I believe this is something related to my initial setup, during which I suffered a little bit activating the virtual environment, however later successfully installed. I’m regularly updating and at every update previous version is uninstalled and the new one is installed from scratch.

I believe it’s time to split my configuration.yaml

I’m not sure how it would apply in a virtual environment.

What are the configuration.yaml settings that you are using for the other cpu readings in the screenshot?

where does it say system monitor component monitors cpu temperature?

It doesn’t state anything about cpu temperature in system monitor…

Did you get the answer to your question?

You need to use the command line sensor for temperature.