Shell Command Error (unknown escape sequence (3:259))

Hello, guys.

Im trying to implement a shell command to enable a feature im my Smartthings AC. In Smartthings forum, a guy posted a solution to turn on/off the display of Windfree AC. This is the command:

curl -L -X POST 'https://api.smartthings.com/v1/devices/<device_id>/commands' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
  "commands": [
    {
      "component": "main",
      "capability": "execute",
      "command": "execute",
      "arguments": [
        "mode/vs/0",
          {
             "x.com.samsung.da.options":[
                "Light_On"
             ]
          }
       ]
    }
  ]
}'

So, i try to use shell command integration this way:

ocf_turn_off: "curl -L -X POST 'https://api.smartthings.com/v1/devices/xxxxxxxac5-35d2-69a7-47xxxxxxxxx/commands' --header 'Authorization: Bearer xxxxxxx-b141-4e89-9441-xxxxxxxxxx' --header 'Content-Type: application/json' --data-raw '[{\"commands\":\{ "component": "main","capability": "execute", "command": "execute", "arguments": ["mode/vs/0",{"x.com.samsung.da.options":[ "Light_On"]} ] }]}'"

But, when i try to save shell_command.yml the following error appears:

Where is the error, please?

Anyone, please?

You need to be patient on the forums.

Rather use the REST command integration.

Otherwise, you need to fix your escaping. My preference is to avoid the outermost double quotes and make it a mutliline YAML syntax with >.

Your problem is that you have double quotes within double quotes. All the inner double quotes must be escaped. It looks like you did it for the command string, but nothing else. Either escape all of them, or use mutliline YAML syntax, or use a REST command.

Yeah, this tip was given by ChatGPT too. I`ll let the correct sintaxe here if someone has the same question:

ocf_turn_off_display: >
    curl -L -X POST "https://api.smartthings.com/v1/devices/<DEVICE ID HERE>" 
    -H "Authorization: Bearer <YOUR TOKEN HERE>" 
    -H "Content-Type: application/json" 
    --data-raw '{"commands":[{"component":"main","capability":"execute","command":"execute","arguments":["mode/vs/0",{"x.com.samsung.da.options":["Light_On"]}]}]}'