System monitor shows the cpu temperature for RPi? I don’t see it under configuration variables.
No system monitor does not include CPU temperature. Use this 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) }}'
And for the GPU:
- platform: command_line
name: GPU Temperature
command: "/opt/vc/bin/vcgencmd measure_temp"
unit_of_measurement: "°C"
value_template: '{{ value | replace("temp=", "") | replace("''C", "") }}'
On my system (Raspbian Release 9.6, Kernel version: 4.14) I do not have this command…
Any time I use the degree symbol in my yaml, like:
unit_of_measurement: “°C”
I get an error:
Error loading /config/configuration.yaml: ‘utf-8’ codec can’t decode byte 0xb0 in position 2830: invalid start byte
It works fine if I leave that line out.
Try using different quotes. Single quotes work, also note the difference between your double quotes and the ones below.
unit_of_measurement: '°C'
unit_of_measurement: "°C"
I tried both kinds of quotes, no difference. The double quotes only looked wrong here in the forum because I quoted the line instead of using a code block like I should have.
I also verified that I’m using ASCII character decimal 176, xB0.
If I delete just that one character, the config checks OK. If I re-add it, I get the error again. I’ve already moved on, not worth worrying about. I used legit’s method of displaying in F, which works fine.
Use notepad++ and make sure the format of the file is UTF8… Sometimes it changes to western or something like that…
Bingo!! Changed it to UTF8 and no more errors. Thanks!!!
Yeah that error is a bastard to track down.
Any reason you don’t do this within the customise section in GUI?
Do what specifically?
It works for HassOS.
this does not work anymore on 64 bit hassio image.
core-ssh:~# cat /sys/class/thermal/thermal_zone0/temp
cat: read error: Invalid argument
Agreed, I am getting the same error when attempting this command on my Pi 4B running HassOS 3.3 64 bit.
HassOS 3.3? How do you get that version, I am still on 2.12 and it doesn’t offer an upgrade?
Just my personal opinion but; unless you need to address more than 4G of RAM, a 64bit O/S won’t buy you anything more than the 32bit O/S has to give you.
HassOS 3.4 has been released which fixes the CPU temp command for those affected (usage example):
cat /sys/class/thermal/thermal_zone0/temp
I measure mine in this way:
- platform: command_line
name: CPU Temp
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(1) }}"
- platform: command_line
name: GPU Temp
command: "/opt/vc/bin/vcgencmd measure_temp"
unit_of_measurement: "°C"
value_template: '{{ value | regex_findall_index("=([0-9]*\.[0-9]*)", 0) }}'
- platform: command_line
name: CPU Clock
command: "/opt/vc/bin/vcgencmd measure_clock arm"
unit_of_measurement: "MHz"
value_template: '{{ value | regex_findall_index("=([0-9]*)", 0) | multiply(0.000001) | round(0) }}'
I’m getting the sensor value in °F
# Sensor entry for Configuration.yaml
- platform: command_line
name: RPi 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) }}'
Is this just LoveLace trying to be smart and show me it in imperial units (which is the standard for my system)?