Try to re-configure command_line after the YAML configuration has moved, but I am not able to make it work anymore

Hi.
So I got this message “Command Line YAML configuration has moved” and I have tried to move to a new configuration, but I don’t manage to get it working.
image

This is my before config:

binary_sensor:
  - platform: command_line
    name: mStream HTTP Response Status #https://community.home-assistant.io/t/how-do-i-check-the-availability-of-a-webserver/43969/19
    command: response=$(curl -LIk -m 3 http://10.0.24.10:3000/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: UnRAID HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10/Main -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: UnRAID API HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:3005/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: CrashPlan HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:5800/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: Deemix HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:6595/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: AirSonic HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:4040/login -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: pfSense HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.1.1/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: ESXi HTTP Response Status
    command: response=$(curl -LIk -m 3 https://10.0.1.2/ui/#/login --insecure -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: ZWaveJS2MQTT HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.8:8091/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: Flemmingss.com HTTP Response Status
    command: response=$(curl -LIk -m 3 https://flemmingss.com/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: mStream HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:3000/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: Jellyseerr HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:5055/login -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: Jellyfin HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:8096/web/index.html -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'
    
  - platform: command_line
    name: Bazarr HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:6767 -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: command_line
    name: qBittorrent HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:8080/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'


This is my after config:

command_line:
  - platform: sensor
    unique_id: mstream_http_response_code
    name: mStream HTTP Response Code
    command: curl -I http://10.0.24.10:3000/ 2>/dev/null | head -n 1 | cut -d$' ' -f2
    scan_interval: 60

  - platform: binary_sensor
    unique_id: unraid_http_response_status
    name: UnRAID HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10/Main -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: unraid_api_http_response_status
    name: UnRAID API HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:3005/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: deemix_http_response_status
    name: Deemix HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:6595/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: pfsense_http_response_status
    name: pfSense HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.1.1/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: zwavejsui_http_response_status
    name: Z-Wave JS UI HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:8091/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: flemmingss_dot_com_http_response_status
    name: Flemmingss.com HTTP Response Status
    command: response=$(curl -LIk -m 3 https://flemmingss.com/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: jellyseerr_http_response_status
    name: Jellyseerr HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:5055/login -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: jellyfin_http_response_status
    name: Jellyfin HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:8096/web/index.html -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'
    
  - platform: binary_sensor
    unique_id: bazarr_http_response_status
    name: Bazarr HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:6767 -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - platform: binary_sensor
    unique_id: qbittorrent_http_response_status
    name: qBittorrent HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:8080/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

It gives me some errors, but can’t realy see what.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/homeassistant/__init__.py:316
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 14:03:19 (14 occurrences)
Last logged: 14:25:48

[140343821336640] Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [command_line]: [platform] is an invalid option for [command_line]. Check: command_line->command_line->0->platform. (See /config/configuration.yaml, line 583).
[140343821336640] Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [command_line]: [platform] is an invalid option for [command_line]. Check: command_line->command_line->0->platform. (See /config/configuration.yaml, line 584).
[140343441558720] Cannot quick reload all YAML configurations because the configuration is not valid: Error loading /config/configuration.yaml: while parsing a block mapping in "/config/configuration.yaml", line 585, column 5 expected <block end>, but found '<scalar>' in "/config/configuration.yaml", line 594, column 15
[140343475173568] Cannot quick reload all YAML configurations because the configuration is not valid: Error loading /config/configuration.yaml: while parsing a block mapping in "/config/configuration.yaml", line 585, column 5 expected <block end>, but found '<scalar>' in "/config/configuration.yaml", line 594, column 15
[140343446999232] Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [command_line]: [platform] is an invalid option for [command_line]. Check: command_line->command_line->0->platform. (See /config/configuration.yaml, line 584).
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 980, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 316, in async_handle_reload_all
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [command_line]: [platform] is an invalid option for [command_line]. Check: command_line->command_line->0->platform. (See /config/configuration.yaml, line 582). 
Platform error binary_sensor.time_date - No module named 'homeassistant.components.time_date.binary_sensor'

Anyone see?

The docs show:

# Example configuration.yaml entry
command_line:
  - sensor:
      command: SENSOR_COMMAND

You have

command_line:
  - platform: sensor
    unique_id: mstream_http_response_code

Notice that you’re missing some indenting.

1 Like

I read that in the docu, but when I try to change it i get errors in my editor.

incomplete explicit mapping pair; a key node is missedYAML

EDIT: Let me try som more, I see what you mean

EDIT2:
Did some changes, a lot better, but still some errors.


command_line:
  - sensor:
      unique_id: mstream_http_response_code
      name: mStream HTTP Response Code
      command: curl -I http://10.0.24.10:3000/ 2>/dev/null | head -n 1 | cut -d$' ' -f2
      scan_interval: 60

  - binary_sensor:
      unique_id: unraid_http_response_status
      name: UnRAID HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10/Main -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
    unique_id: unraid_api_http_response_status
    name: UnRAID API HTTP Response Status
    command: response=$(curl -LIk -m 3 http://10.0.24.10:3005/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
    scan_interval: 60
    value_template: '{{ value }}'
    device_class: 'problem'

  - binary_sensor:
      unique_id: deemix_http_response_status
      name: Deemix HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10:6595/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
      unique_id: pfsense_http_response_status
      name: pfSense HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.1.1/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
      unique_id: zwavejsui_http_response_status
      name: Z-Wave JS UI HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10:8091/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
      unique_id: flemmingss_dot_com_http_response_status
      name: Flemmingss.com HTTP Response Status
      command: response=$(curl -LIk -m 3 https://flemmingss.com/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
      unique_id: jellyseerr_http_response_status
      name: Jellyseerr HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10:5055/login -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
      unique_id: jellyfin_http_response_status
      name: Jellyfin HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10:8096/web/index.html -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'
    
  - binary_sensor:
      unique_id: bazarr_http_response_status
      name: Bazarr HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10:6767 -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'

  - binary_sensor:
      unique_id: qbittorrent_http_response_status
      name: qBittorrent HTTP Response Status
      command: response=$(curl -LIk -m 3 http://10.0.24.10:8080/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
      scan_interval: 60
      value_template: '{{ value }}'
      device_class: 'problem'




Configuration invalid!
Invalid config for [command_line]: expected a dictionary for dictionary value @ data['command_line'][2]['binary_sensor']. Got None
extra keys not allowed @ data['command_line'][2]['command']. Got 'response=$(curl -LIk -m 3 http://10.0.24.10:3005/ -o /dev/null -w "%{http_code}\\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"'
extra keys not allowed @ data['command_line'][2]['device_class']. Got 'problem'
extra keys not allowed @ data['command_line'][2]['name']. Got 'UnRAID API HTTP Response Status'
extra keys not allowed @ data['command_line'][2]['scan_interval']. Got 60
extra keys not allowed @ data['command_line'][2]['unique_id']. Got 'unraid_api_http_response_status'
extra keys not allowed @ data['command_line'][2]['value_template']. Got '{{ value }}'. (See /config/configuration.yaml, line 584).

See a difference?

['command_line'][2]

actually means 3rd command_line definition.

1 Like

I see I forgot that, now it is working perfect.

Good that you got it solved!

Please take the time to mark the answer as solution, you do that by selecting the three dots under the post:

image

Then select the check box:

image

This can be useful to other users as well and prevents that someone else steps in to try to help you.

1 Like