Posted

in

, , , ,

by


Proxmox server temperature tracking in Home Assistant

(Link to the original blog post with a proper layout)

It’s a pity that doesn’t report CPU and other temperatures to .

I had several freezes of my old laptop that runs Proxmox due to a stuck CPU fan. I googled a bit and found an elegant solution for temperature reporting: a command_line sensor.

Nevertheless, it took several hours to configure it correctly (I forgot how to deal with ssh keys and similar).

This is the end result:

home assistant cpu temperature sensor chart

The procedure:

  1. I installed the ‘Terminal & SSH’ add-on in to home assistant.
  2. I created SSH keys, put them into /config/.ssh folder, and copied to my proxmox server. Read these instructions. I’ve put something like this in my HA Terminal addon:
$ mkdir /config/.ssh
$ ssh-keygen # generated ssh keys and when asked, i enter the folder /root/config/.ssh 
$ ssh-copy-id -i /root/config/.ssh/id_proxmox root@MY_PROXMOX_IP # copy keys to my prox server
$ ssh root@MY_PROXMOX_IP #try out if I can log on without password prompt, then exit

3. I had to find out where my proxmox stores temperatures. I ssh’ed to my proxmox again, browsed folders and looked into files which one store temps. My AMD laptop stores it in /sys/class/thermal/thermal_zone0/temp.

It could be also …/thermal_zone1, 2, 3 or similar.

4. Then I pulled temperature data via SSH to HA terminal:

$ ssh -i /config/.ssh/id_prox -o StrictHostKeyChecking=no -q root@YOUR_PROXMOX_IP cat /sys/class/thermal/thermal_zone0/temp

The command returned 52000.

Edited my configuration.yaml and added the sensor. This is a working code (as of Apr. 2024). I used tips from here (deprecated sensor) and here.


##################
# Temperature proxmox
##################
command_line:
– sensor:
name: temperature_cpu
command: “ssh -i /config/.ssh/id_prox -o StrictHostKeyChecking=no -q root@YOUR_PROXMOX_IP cat /sys/class/thermal/thermal_zone0/temp”
value_template: “{{ value | multiply(0.001) | round(1) }}”
unit_of_measurement: “°C”

After 20 restarts of Home Assistant, it finally shows the proxmox CPU temp.

Bonus: here is a picture my homelab proxmox ‘server’ with external fans (because CPU fan is not working).

Bonus : A hypothesis: Fediverse is causing global warming! 😉 😉

When I publish a blog post, the WordPress Activitypub plugin delivers the post to the . This causes the CPU to heat to 75C+. I know it now, because I can track its temp. in HA.

The hypothesis is confirmed.

temperature chart of the CPU, a spike is detected at blog publish time, because of activitypub plugin


Comments

4 responses to “Proxmox server temperature tracking in Home Assistant”

  1. Volker Stolz Avatar

    @tomi Wouldn't it make more sense to run SNMP instead and get the whole shebang from the host OS in one go?

    1. Tomi the Slav and 1024 others Avatar

      @fm_volker @tomi Probably yes, but I already had all the data I need via HomeAssistant HACS Proxmox integration.
      I only needed one more: CPU temp.

      1. Volker Stolz Avatar

        @po3mah @tomi I see. I tried that integration just today, and was a bit underwhelmed that it only delivers "VM up Y/N" — or are there different integrations? I used `proxmoxve`.

        1. Tomi the Slav and 1024 others Avatar

          @fm_volker @tomi I don't use the default one, too little info. I use this one: https://github.com/dougiteixeira/proxmoxve

Leave a Reply

Your email address will not be published. Required fields are marked *