How to show the Raspberry Pi CPU temperature?

Oh wow. You have to escape a single quote with a single quote in YAML!

http://yaml.org/spec/current.html#id2534365 (look at Example 4.57. Single Quoted Quotes)

This works:

- platform: command_line
  name: GPU Temperature
  command: "/opt/vc/bin/vcgencmd measure_temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | replace("temp=", "") | replace("''C", "") }}' 

Thanks for putting me on the right track David.

2 Likes