Invalid config for [shell_command]: expected a dictionary for dictionary value @ data[‘shell_command’]. Got [OrderedDict([(‘AC_on’, ‘curl -X POST -d {{ data }} {{ url }}’)])]. (See /config/configuration.yaml, line 122). Please check the docs at https://home-assistant.io/components/shell_command/
I’ve tried not having the data template and just putting the url and data in the curl command, but some of the trouble may be from the curl command needing ’ and " quotes in it and it didn’t help. I’ve tried escaping them and this and that with no luck. Honestly, I’m using trial and error, but don’t even know if I’m on the right track because this is my first automation that isn’t created using the UI automation wizard.
Please first format the lines from your configuration and automations files so we can read them properly. The easiest way to do that is to select the lines then hit the </> button. This is very important because YAML is very sensitive to indentation, and also without proper formatting certain characters (like quotes and dashes) get changed, as you can see by looking at your post above. Once we’re able to see your YAML code correctly we’ll be able to help.
Having said that, best I can tell is that you need to change your shell_command to:
shell_command:
ac_on: "curl -X POST -d '{{ data }}' {{ url }}"
and the corresponding automation action should be:
UPDATE: Wow, just saw this again. Must not have know what I was doing back then! Updated the data_template to data, since data_template isn’t required here.
Thanks, and sorry, I didn’t see how to format it, but new I could.
I’ve updated my code as you suggested. I no longer have the error in the config validation, but the curl command wasn’t doing what it does in the terminal… until I restarted Home Assistant!
Sorry for bumping an old thread, but having some difficulty with this exact thing. I’m relatively new to Homeassistant but have had success so far, but I’m really stuck here. I have a projector that can use http requests for remote functions. The requests look something like this.
I can’t get it to run, properly and I’ve tried a bunch of variations including not using the data and url variables and just having it hardcoded in the configuration yaml. I’m really at a loss, because when I just copy the url into firefox it runs all of the commands just fine.