tomi, (Link to the original blog post with a proper layout)
It’s a pity that #Proxmox doesn’t report CPU and other temperatures to #homeassistant.
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 chartThe procedure:
- I installed the ‘Terminal & SSH’ add-on in to home assistant.
- 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 <em># generated ssh keys and when asked, i enter the folder /root/config/.ssh</em> $ ssh-copy-id -i /root/config/.ssh/id_proxmox root@MY_PROXMOX_IP <em># copy keys to my prox server</em>$ ssh root@MY_PROXMOX_IP <em>#try out if I can log on without password prompt, then exit</em>
- 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.
- 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 #YAML 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).
https://blog.rozman.info/wp-content/uploads/2024/04/20240415_081455-1024x576.jpgBonus #2: A hypothesis: Fediverse is causing global warming! 😉 😉
When I publish a blog post, the WordPress Activitypub plugin delivers the post to the #fediverse. 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 pluginhttps://blog.rozman.info/proxmox-server-temperature-tracking-in-home-assistant/
Add comment