Would be great to measure the CPU temperature of my remote RPi’s within the LAN home network. As far as I know I need some code like this:
###################################
# Remote CPU Temp
###################################
sensor CPU-Temp:
- platform: command_line
name: "CPU-Temp"
command: ssh [email protected] ??????
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(2) }}'
scan_interval: 120
So far I did not succeed finding the right code to replace the question marks. When connected to the remote RPi on 192.168.2.108 the over SSH code “/opt/vc/bin/vcgencmd measure_temp” shows “temp=43.5’C”. No idea how to convert this to useable code for HA so any advice is very welcome!
When I had RPIs 2/3, these are the commands I used:
For GPU: /opt/vc/bin/vcgencmd measure_temp
You get something like temp=41.5’C
For CPU: cat /sys/class/thermal/thermal_zone0/temp
You get something long number: 41486, you need to divide by 1000
You will need to adjust your value_template accordingly.
See example here
Thanks for helping JT! I have tried both suggestions using this code:
sensor CPU-Temp-MM:
- platform: command_line
name: "CPU-Temp-MM"
command: ssh [email protected] cat /sys/class/thermal/thermal_zone0/temp
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(2) }}'
scan_interval: 30
sensor CPU-Temp-MM-GPU:
- platform: command_line
name: "CPU-Temp-MM-GPU"
command: ssh [email protected] /opt/vc/bin/vcgencmd measure_temp
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(2) }}'
scan_interval: 30
Unfortunately it does not work, the values are not shown within my card. Any other suggestions?
After some struggling with different solutions I now use https://github.com/ned-kelly/ha-monitor-api which worked fine for me.
I did test this as well: very nice project, added to my setup too!