Configuring Command Line sensor using YAML has moved

Hello good folk of HA,
I need some assistance please. I have read the documentation and I cannot make heads or tails of why I cannot get this to work, below is original code I have before updating and attempting to make it work. But I do not know how to integrate this to work with the latest update.

Is there anyone willing to help me with this please?

sensor:
# RPi System monitors
  - platform: systemmonitor
    resources:
    - type: processor_use
    - type: disk_use_percent
      arg: "/"
    - type: disk_free
      arg: "/"
    - type: memory_use_percent
    - type: processor_temperature
    - type: last_boot
    
# Time
  - platform: time_date
    display_options:
      - 'time_date'
      - 'date_time_iso'
      - 'date'

  - platform: template
    sensors:
      time_formatted:
        friendly_name: "Date and time"
        value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%H:%M, %a %d %b %Y') }}"
        icon_template: mdi:calendar-clock
    
# CPU Raspberry Pi Temp
  - 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(2)  }}'

# Sensor to track available updates for supervisor & addons
  - 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,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
    value_template: "{{ value_json.addons | length }}"
    unit_of_measurement: pending update(s)
    json_attributes:
    - update_available
    - newest_version
    - current_version
    - addon

#Teams Status'
  - platform: template
    sensors:
      teams_status: 
        friendly_name: "Microsoft Teams status"
        value_template: "{{states('input_text.teams_status')}}"
        unique_id: sensor.teams_status
      teams_cam_status:
        friendly_name: "Microsoft Teams Camera Status"
        value_template: "{{states('input_text.teams_cam_status')}}"
        unique_id: sensor.teams_cam_status        
      teams_activity:
        friendly_name: "Microsoft Teams activity"
        value_template: "{{states('input_text.teams_activity')}}"
        unique_id: sensor.teams_activity

This is the best I have come up with but it is not working. I did notice that I had CPU temp twice, the new and old ways. But I would prefer to keep the rest of the system monitors if possible. And I have no idea where to place the Date_time sensors anymore, or the teams status sensors. That would not be under command line, I would think?

#sensor:
# RPi System monitors
#  - platform: systemmonitor
#    resources:
#    - type: processor_use
#    - type: disk_use_percent
#      arg: "/"
#    - type: disk_free
#      arg: "/"
#    - type: memory_use_percent
#    - type: processor_temperature
#    - type: last_boot
command_line:
    sensor:    
    # Time
      - platform: time_date
        display_options:
          - 'time_date'
          - 'date_time_iso'
          - 'date'
    
      - platform: template
        sensors:
          time_formatted:
            friendly_name: "Date and time"
            value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%H:%M, %a %d %b %Y') }}"
            icon_template: mdi:calendar-clock
        
    # CPU Raspberry Pi Temp
    
      - sensor:
          name: 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) }}"
    
    # Sensor to track available updates for supervisor & addons
      - 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,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
        value_template: "{{ value_json.addons | length }}"
        unit_of_measurement: pending update(s)
        json_attributes:
        - update_available
        - newest_version
        - current_version
        - addon
    
    #Teams Status'
      - platform: template
        sensors:
          teams_status: 
            friendly_name: "Microsoft Teams status"
            value_template: "{{states('input_text.teams_status')}}"
            unique_id: sensor.teams_status
          teams_cam_status:
            friendly_name: "Microsoft Teams Camera Status"
            value_template: "{{states('input_text.teams_cam_status')}}"
            unique_id: sensor.teams_cam_status        
          teams_activity:
            friendly_name: "Microsoft Teams activity"
            value_template: "{{states('input_text.teams_activity')}}"
            unique_id: sensor.teams_activity
command_line:
  - sensor:
      name: CPU Temp
      command: "cat /sys/class/thermal/thermal_zone0/temp"
      unit_of_measurement: "°C"
      value_template: '{{ value | multiply(0.001) | round(2)  }}'
  - sensor:
      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,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
      value_template: "{{ value_json.addons | length }}"
      unit_of_measurement: pending update(s)
      json_attributes:
        - update_available
        - newest_version
        - current_version
        - addon

sensor:
# RPi System monitors
  - platform: systemmonitor
    resources:
    - type: processor_use
    - type: disk_use_percent
      arg: "/"
    - type: disk_free
      arg: "/"
    - type: memory_use_percent
    - type: processor_temperature
    - type: last_boot
    
# Time
  - platform: time_date
    display_options:
      - 'time_date'
      - 'date_time_iso'
      - 'date'

  - platform: template
    sensors:
      time_formatted:
        friendly_name: "Date and time"
        value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%H:%M, %a %d %b %Y') }}"
        icon_template: mdi:calendar-clock

#Teams Status'
  - platform: template
    sensors:
      teams_status: 
        friendly_name: "Microsoft Teams status"
        value_template: "{{states('input_text.teams_status')}}"
        unique_id: sensor.teams_status
      teams_cam_status:
        friendly_name: "Microsoft Teams Camera Status"
        value_template: "{{states('input_text.teams_cam_status')}}"
        unique_id: sensor.teams_cam_status        
      teams_activity:
        friendly_name: "Microsoft Teams activity"
        value_template: "{{states('input_text.teams_activity')}}"
        unique_id: sensor.teams_activity
1 Like

You are a legend! Thank you so much!

I see so sensor was not removed it was just that command-line was. That makes much more sense.

EDIT: Sorry, moved, not removed…

1 Like