Repair line YAML configuration has moved - help with code

Hi All,

I’ve got myself in a pickle with the update to 2023.6.1 and my YAML.

I get an error “Repair Line YAML Configuration has moved” but no further details when I click on it (it shows up as a repair on settings page.

The original code I had was:

- platform: command_line

 command: "python3 /config/pyscripts/get_agile_incoming_ordered.py"

 scan_interval: 315360000

 value_template: '{{value_json.Run_number1}}'

 json_attributes:

   - Run_number1

   - Run_number2

   - Run_number3

   - Run_number4

   - Run_number5

   - Run_number6

   - Run_number7

   - Run_number8

   - Run_number9

   - Run_number10

   - cost_number1

   - cost_number2

   - cost_number3

   - cost_number4

   - cost_number5

   - cost_number6

   - cost_number7

   - cost_number8

   - cost_number9

   - cost_number10

   - start_time1

   - start_time2

   - start_time3

   - start_time4

   - start_time5

   - start_time6

   - start_time7

   - start_time8

   - start_time9

   - start_time10

   - end_time1

   - end_time2

   - end_time3

   - end_time4

   - end_time5

   - end_time6

   - end_time7

   - end_time8

   - end_time9

   - end_time10

   - min_rate1

   - max_rate1

   - mean_rate1

 name: octopus_agile_range_ordered

 unique_id: octagrangeinord1

notify:

 - name: "Give_Charge"

   platform: smtp

   server: "smtp.gmail.com"

   port: 587

   timeout: 15

   sender: !secret email_sender

   encryption: starttls

   username: !secret email_user

   password: !secret email_password

   recipient:

     - "[email protected]"

   sender_name: "Inverter"

  

And I tried to change to to command_line as I understood it in the new command_line help page as:

command_line:
  command: "python3 /config/pyscripts/get_agile_incoming_ordered.py"
  scan_interval: 315360000 
  value_template: '{{value_json.Run_number1}}'
  json_attributes:
    - Run_number1
    - Run_number2
    - Run_number3
    - Run_number4
    - Run_number5
    - Run_number6
    - Run_number7
    - Run_number8
    - Run_number9
    - Run_number10
    - cost_number1
    - cost_number2
    - cost_number3
    - cost_number4
    - cost_number5
    - cost_number6
    - cost_number7
    - cost_number8
    - cost_number9
    - cost_number10
    - start_time1
    - start_time2
    - start_time3
    - start_time4
    - start_time5
    - start_time6
    - start_time7
    - start_time8
    - start_time9
    - start_time10
    - end_time1
    - end_time2
    - end_time3
    - end_time4
    - end_time5
    - end_time6
    - end_time7
    - end_time8
    - end_time9
    - end_time10
    - min_rate1
    - max_rate1
    - mean_rate1
  name: octopus_agile_range_ordered
  unique_id: octagrangeinord1


  notify:
    - name: "Give_Charge"
      platform: smtp
      server: "smtp.gmail.com"
      port: 587
      timeout: 15
      sender: !secret email_sender
      encryption: starttls
      username: !secret email_user
      password: !secret email_password
      recipient:
        - "[email protected]"
      sender_name: "Inverter" 

Can someone explain to me what I have done wrong so I can understand it for next time?

For ref, there are other bits in the configuration.yaml, but if I remove this section, the file passes validation, with it in, it fails.

Error I get when validating configuration is :

Invalid config for [command_line]: [command] is an invalid option for [command_line]. Check: command_line->command_line->0->command. (See /config/configuration.yaml, line 24).
command_line:
  - sensor:
      command: etc...

You overlooked to include the sensor key in your configuration of the Command Line sensor.

command_line:
  - sensor:
      command: "python3 /config/pyscripts/get_agile_incoming_ordered.py"
      scan_interval: 315360000 
      value_template: '{{value_json.Run_number1}}'
      json_attributes:
        - Run_number1
        - Run_number2
        - etc etc

In addition, you put the configuration for an SMTP Notification entity under the command_line: key. Move it out of there.


EDIT

Ninja’d by tom_l

Thanks both! Looking again at the documentation it clearly showed the -sensor: that I missed!

@123 if i understand you correctly, the notification bit should be “Outside” of the command_line section?

Correct. Simply shift those lines to the left by two spaces.

So now it looks like this:

command_line:
  - sensor:
      command: "python3 /config/pyscripts/get_agile_incoming_ordered.py"
      scan_interval: 315360000 
      value_template: '{{value_json.Run_number1}}'
      json_attributes:
        - Run_number1
        - Run_number2
        - Run_number3
        - Run_number4
        - Run_number5
        - Run_number6
        - Run_number7
        - Run_number8
        - Run_number9
        - Run_number10
        - cost_number1
        - cost_number2
        - cost_number3
        - cost_number4
        - cost_number5
        - cost_number6
        - cost_number7
        - cost_number8
        - cost_number9
        - cost_number10
        - start_time1
        - start_time2
        - start_time3
        - start_time4
        - start_time5
        - start_time6
        - start_time7
        - start_time8
        - start_time9
        - start_time10
        - end_time1
        - end_time2
        - end_time3
        - end_time4
        - end_time5
        - end_time6
        - end_time7
        - end_time8
        - end_time9
        - end_time10
        - min_rate1
        - max_rate1
        - mean_rate1
      name: octopus_agile_range_ordered
      unique_id: octagrangeinord1


notify:
  - name: "Give_Charge"
    platform: smtp
    server: "smtp.gmail.com"
    port: 587
    timeout: 15
    sender: !secret email_sender
    encryption: starttls
    username: !secret email_user
    password: !secret email_password
    recipient:
      - "[email protected]"
    sender_name: "Inverter" 

which is no longer throwing errors! thanks both!