I have **Motion** installed on my PI and having difficulty trying to control the threshold via the command line.

Motion's [wiki][1] suggests that this type of control can be done using cron like this:

    0 9 * * * root /usr/bin/lwp-request http://localhost:8080/0/detection/start > /dev/null




So i tried this on the command line:

  

     /usr/bin/wget http://localhost:8091/0/config/set?threshold=4000 > /dev/null

and goth this:

    Resolving localhost (localhost)... 127.0.0.1, ::1
    Connecting to localhost (localhost)|127.0.0.1|:8091... connected.
    HTTP request sent, awaiting response... 401 Authorization Required
    Authorization failed.


I tried this on my laptop's browser connected to the same network:
  
      http://192.168.1.51:8091/0/config/set?threshold=2000&username=myusername&password=mypassword

and it appeared to work without having to enter my username and password manually.

so i then tried on the command line:

    sudo /usr/bin/wget http://192.168.1.51:8091/0/config/set?threshold=4000&username=myusername&password=mypassword >/dev/null

and got :

    Connecting to 192.168.1.51:8091... connected.
    HTTP request sent, awaiting response... 401 Authorization Required
    Authorization failed.
    
    [1]-  Exit 6                  sudo /usr/bin/wget http://192.168.1.51:8091/0/config/set?threshold=4000
    [2]+  Done                    username=myusername



 

1) Did this not work because of having [control_authentication][2] set up?

2) Is it possible to control motion in this way with authentication set up if so how?

3) Am I approaching this in the correct way?


  [1]: http://www.lavrsen.dk/foswiki/bin/view/Motion/RemoteControlHttp
  [2]: http://www.lavrsen.dk/foswiki/bin/view/Motion/ConfigOptionControlAuthentication