Command Line Sensors Not Working

I am having some trouble displaying sensor information from Command Line Sensors. The ‘CPU Temperature’ sensor as well as the ‘Disk Space’ sensor do not show up at all in lovelace, and the ‘Supervisor Updates’ sensor shows as a temperature sensor. Anyone have any idea what is wrong with them?

- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°F"
  value_template: '{{ value | multiply(0.001) | round(1) }}'
  
  name: Disk Space
  command: "df -h|grep -w /|awk '{ print $4 }'"
  value_template: '{{ value|regex_findall_index("\d+\.?\d+|\d+") | float }}'
  scan_interval: 3600
  
  name: Supervisor Updates
  command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"addons":[.data.addons[] | select(.version != .installed)]}'''
  value_template: "{{ value_json.addons | length }}"
  json_attributes:
  - newest_version
  - current_version
  - addons

- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°F"
  value_template: '{{ value | multiply(0.001) | round(1) }}'

- platform: command_line
  name: Disk Space
  command: "df -h|grep -w /|awk '{ print $4 }'"
  value_template: '{{ value|regex_findall_index("\d+\.?\d+|\d+") | float }}'
  scan_interval: 3600

- platform: command_line
  name: Supervisor Updates
  command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"addons":[.data.addons[] | select(.version != .installed)]}'''
  value_template: "{{ value_json.addons | length }}"
  json_attributes:
  - newest_version
  - current_version
  - addons

Oh I did not realize you can’t nest them under one command line platform. Thank you!

1 Like