I wanted to share my configuration.yaml and how access RAM and CPU parameters and request feedback from the community. Thanks and hopefully it helps others!
# Example configuration.yaml entry
command_line:
- sensor:
name: CPU Temperature
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) }}"
- sensor:
name: CPU Usage
command: 'echo $(top -n 1 | sed -n "2p") | sed -e "s/.*CPU: \(.*\)% usr.*/\1/"'
unit_of_measurement: "%"
value_template: "{{ value }}"
- sensor:
name: RAM Usage
command: 'echo $(top -n 1 | sed -n "1p") | sed -e "s/.*Mem: \(.*\)K used.*/\1/"'
unit_of_measurement: "GB"
value_template: "{{ value | multiply(0.000001) | round(1) }}"