Switch - Command line help

I’m stuck trying to create a command line switch using curl.

        command_on: "curl -k -X POST http://x.x.x.x/cr?pw=password&t=[0,0,0,0,0,0,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
        command_off: "curl -k -X GET http://x.x.x.x/sn7=0"
        command_state: "curl -k -X GET http://x.x.x.x/sn7"
        value_template: "{{ value == '1' }}"

For some reason my command_on curl command doesn’t work.
Any help appreciated

Since you’re using http: (not https:) I don’t think you need -k. But you probably do need -s (aka, --silent.)

Have you tried the -u option?


    command_on: 'curl -X POST -u username:password "http://x.x.x.x/cr?t=[0,0,0,0,0,0,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"'

Try command in putty, then you see the error why it’s not working

1 Like

Thanks for your help guys, I was stuck on this for ages.
I’ve since found a solution on stack overflow ->
curl -G -v http://x.x.x.x/cr --data-urlencode pw=password --data-urlencode t=[0,0,0,0,0,0,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Apparently, I needed to encode the data.

Now I have an awesome Switch to fill up my pool (OpenSprinkler).
The switch changes color while filling so I know it’s working :slight_smile: