I run HA in a VM on a Proxmox host and since migrating from a Pi 3B+, I’ve wanted to keep an eye on the host’s CPU temp. Most of the info below is from this awesome community but I thought it would help to have it in once place
Digital Ocean has a great guide for creating a pair of SSH keys. Essentially you’ll want to run the following commands:
To generate the SSH key on the HA VM (I used the Terminal & SSH add-on). No name or passphrase are required.
$ ssh-keygen
To push the public key to the Proxmox server:
$ ssh-copy-id username@proxmox_host_ip
You should now be able to SSH to the Proxmox host without needing to enter a password. I tested this by running the following command in the Terminal & SSH add-on in HA.
$ ssh username@proxmox__host
$ exit
I found that the sensor in HA couldn’t get to the default /root/.ssh/ directory so I copied the id_rsa file to the HA config directory. Once again, using the Terminal & SSH add-on in HA.
$ cp /root/.ssh/id_rsa /config
From here, it’s just the config in HA. You’ll need to enter the username & IP address for your Proxmox most. Thermal_zone2 is the CPU package temp for me.
command_line:
- sensor:
name: "Lenovo M720q CPU Temp"
command: "ssh -i /config/id_rsa -o StrictHostKeyChecking=no username@proxmox_host_ip -t 'cat /sys/class/thermal/thermal_zone2/temp'"
unit_of_measurement: "°C"
scan_interval: 300
value_template: "{{ (value | multiply(0.001)) | round(1) }}"
And here we are - CPU temp showing in lovelace!