New "Repair" after 22.06

Can anyone specify what this has to do with?
yaml

1 Like

Staffan, they have updated the syntax for command line sensors. Check:

You also have numerous of posts in this thread about the same issue:

And in future please read the breaking changes in the release notes before updating.

1 Like

Never been much of a YAML user but I had some sensors. A System Monitor and a Ping. I think I managed to rewrite the CPU, GPU and the Ping. However what to do with System Monitoring lines, I cant figure out by myself. Can anyone help out with the ones I have commented out for now?

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: GPU Temperature

      command: "/opt/vc/bin/vcgencmd measure_temp"

      unit_of_measurement: "°C"

      value_template: '{{ value | replace("temp=", "") | replace("''C", "") }}'

  #  - platform: systemmonitor

  #    resources:

  #      - type: last_boot

  #      - type: disk_use_percent

  #        arg: /

  #      - type: memory_use_percent

  #      - type: processor_use

  - binary_sensor:

      name: xxxxxxx

      command: "ping -W 1 -c 1 192.168.1.50 > /dev/null 2>&1 && echo success || echo fail"

      device_class: connectivity

      payload_on: "success"

      payload_off: "fail"

Trying to fix the same issue here…

I have moved this from sensor.yaml to configuration.yaml

# update the lastest ABC News Podcast
- platform: command_line
  name: Latest ABC News Bulletin
  scan_interval: 3600 # Every hour
  command: curl -k -s https://www.abc.net.au/feeds/101858056/podcast.xml | grep -E -o 'https?://[^"]+mp3' | uniq | head -n 1

Not I get… Configuration invalid!

Configuration invalid!
Invalid config for [command_line]: [name] is an invalid option for [command_line]. Check: command_line->command_line->0->name. (See /config/configuration.yaml, line 61).

The documentation clearly specifies a name, so what’s the story?

**** Update ****
Seems you need to put “- sensor:” in the configuration. Don’t think that is clear in the documentation… ie:

# update the lastest ABC News Podcast
command_line:
  - sensor:
      name: Latest ABC News Bulletin
      scan_interval: 3600 # Every hour
      command: curl -k -s https://www.abc.net.au/feeds/101858056/podcast.xml | grep -E -o 'https?://[^"]+mp3' | uniq | head -n 1

Every example has the dash, literally

1 Like

So it does :grimacing:, it also says that the map is optional. Doesn’t seem to be. Perhaps I am not reading the documentation correctly.