1

I have read every other thread on this topic and none of them seem to illuminate what is happening.

I am trying to send a CURL command to my Home Assistant instance by executing a batch file.

C:\Windows\System32\curl.exe -X POST -H "Authorization: Bearer token removed" -H "Content-Type: application/json" -d '{ \"entity_id\":\"script.fan_turnon\" }' http://192.168.1.XXX:8123/api/services/script/turn_on

This command works flawlessly in the command prompt but as a .bat or .cmd a window briefly opens and then disappears. I have attempted to add pause to the end but the same result. What have I stuffed up?

Note: personally identifying information removed from code

Broheim
  • 11
  • 1
  • 1
    if any of your redacted strings contains a symbol, especially `%` you may have problems. Try posting those strings, replacing alphamerics with `abc123`. – Magoo Aug 02 '22 at 03:19
  • 2
    Open the command prompt and run the script from there instead of double-clicking on the script. The window will stay open and you'll be able to read the error message that you get. – SomethingDark Aug 02 '22 at 03:20
  • @SomethingDark it says `curl: (3) URL using bad/illegal format or missing URL curl: (3) unmatched close brace/bracket in URL position 1: }' ^` – Broheim Aug 02 '22 at 03:38
  • Solved - it was the single quotes, needed to be double quotes – Broheim Aug 02 '22 at 03:41

1 Answers1

0

Solved - it was the single quotes, needed to be double quotes

Broheim
  • 11
  • 1