Yellow: How to read the CM4 temp?

Hi,
Just starting with my new Yellow (used to use a VM w/ HAOS). Pretty cool device.
One of the first things that occurred to me is - how do I monitor its own temperature? The heat sink does get warmish even under minimal load, which immediately makes me want to have a HA entity holding the env info of the CM4 - primarily, temperature.
Any pointers as to how to get that?
Thanks!

Answering my own question, which I’m leaving for posterity. Taken from https://www.home-assistant.io/integrations/sensor.command_line/

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

EDIT 2023-08-31: Due to HA changes, the code needs to be a bit different (see below), like this:

command_line:
  - sensor:
      name: CPU Temperature
      unique_id: sensor.yellow_cpu_temp
      command: "cat /sys/class/thermal/thermal_zone0/temp"
      # If errors occur, make sure configuration file is encoded as UTF-8
      unit_of_measurement: "°C"
      value_template: "{{ value | multiply(0.001) | round(1) }}"
3 Likes

@doron, Thanks

Just what I was looking for to my newly arrived HA Yellow to get some health info, thought all this would be available default but not.
Do you have other sensors also that are readable from the unit?

Thanks,
AseKarlsson

I’m getting an error. Looks like when I reboot 2023.8 removes the command line sensor. Indicates that it’s deprecated in a version?

It used to be something like:

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

now it’s

command_line:
  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) }}"

See the docs .

2 Likes

Thank you,

However I receive the following error when checking the configuration from Developer Tools.

Invalid config for [command_line]: expected a dictionary for dictionary value @ data[‘command_line’][0][‘sensor’]. Got None. (See /config/configuration.yaml, line 30).

This is working for me, right now:

command_line:
  - sensor:
      name: CPU Temperature
      unique_id: sensor.yellow_cpu_temp
      command: "cat /sys/class/thermal/thermal_zone0/temp"
      # If errors occur, make sure configuration file is encoded as UTF-8
      unit_of_measurement: "°C"
      value_template: "{{ value | multiply(0.001) | round(1) }}"
2 Likes

I can confirm that @doron code example works for me as well. Thank you!

Code works for me as well, thank you @doron !
I really like having this information integrated into HA. If I get adventurous it would be cool to pair this with some addressable LEDs