Shell command help

im trying to make a shell command but im keep getting this error

2017-11-07 15:35:31 ERROR (SyncWorker_0) [homeassistant.util.yaml] while parsing a block mapping
  in "/config/configuration.yaml", line 416, column 3
expected <block end>, but found '{'
  in "/config/configuration.yaml", line 418, column 9
2017-11-07 15:35:31 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: while parsing a block mapping
  in "/config/configuration.yaml", line 416, column 3
expected <block end>, but found '{'
  in "/config/configuration.yaml", line 418, column 9

this is my confi yaml

shell_command:
  radio_test: 'curl -X POST -H "x-ha-access: MY_PASSWORD" \
    -H "Content-Type: application/json" \
    -d '{"state": "on", "attributes": {"friendly_name": "Radio"}}' \
    http://localhost:8123/api/states/binary_sensor.radio'

hope some can help thank you

Hi @Kem, not sure, but have you tried to write your command in one line?
I think this line-continuation will not work in yaml.

I think you have nested ' characters. The ' after the -d closes the one at the start of the command, so the yaml parser thinks the next { character is something it should parse.

I’m not sure how to escape that, but you might try a \ before the middle ones like

   -d \'{"state": "on", "attributes": {"friendly_name": "Radio"}}\'

thank you guys for taking time to help im still getting the same error with both of your suggestions

You could try removing the outside ' characters. I’m not sure they are necessary.

I would simplify the yaml by putting the curl command into its own shell script and then just call the shell script

thanks for the suggestion but i dont know anything about sell scripts it would be nice if you can post an example thank you again guys for your time