Command line switch issue

Hi there,

I am having a small issue with my command line configuration. The switch is there, but I am hoping to make an http call and run a php script. Recently, my php server went down, but it is now up.

Here is my configuration. Note, I removed the http address as I want to keep my server private.

switch:
  platform: command_line
  switches:
mailbox_on:
  command_on: "/usr/bin/curl -X http://google.com/counter/count.php?thevent=mailbox.txt"
  command_off: "/usr/bin/curl -X http://google.com/count.php?thevent=random.txt"

Any help would be greatly appreciated.

Have you tried without the -X switch?

It’s a good idea to make sure that the command completes from a command line before setting it up in HASS.

I believe that -X wants/waits for additional input.

Right! I hadn’t really gave it much thought about the command line. Thank you for clarifying this for me. I did some testing in the command line and got things going.

Initially I received a 406 error with my request. In case anyone get this error, here is what II found solved it:

/usr/bin/curl http://google.com.com/counter/count.php?thevent=mailbox.txt -A 'Mozilla'

Adding -A ‘Mozilla’ to end the end of the command fixed it. Thanks for your direction. Much appreciated!