Shell Command works as script but not command

I have written a very simple script to call an API for my WiiM Mini. The script is;



curl -X GET -k "$INPUT"

I have saved this in /config/shell and made it executable;

I can run this from the terminal, and it works fine (using a supplied text value)

./ "bluetooth"

and there are no errors. I’m using the -k parameter as the https certificate on the WiiM is not valid, and it will not work with http.

However, when I try this from a shell_conmmand it does not work correctly. Here is the command entry;

wiim_set_input: /config/shell/ '{{ states("input_select.bedroom_tv_input")}}'

I am testing this from the developer tools with

service: shell_command.wiim_set_input
  input: {{ states('input_select.bedroom_tv_input') }}

The response is

stdout: OK
stderr: "% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\r100     2  100     2    0     0     20      0 --:--:-- --:--:-- --:--:--    20"
returncode: 0

and whlst it will change the input on each call to “wifi” if it is on anything else, it does not change it to the correct value (i.e. if I set bluetooth and it is currently on “line-in” then it is set to wifi. I have also tried specifiying the input as a string with the command in the developer tools and it behaves in the same way. I’ve tried everything I can think of in terms of syntax but I really do not understand what I am doing wrong here.

…and of course it’s working now. Thanks!

I’m glad it’s working, but for your future reference, the input part of this shell command service call isn’t doing anything. Input isn’t a defined parameter of shell command service calls, and anyway, you’ve already included the current state of the input_select as a parameter in the definition of the shell command.