Skip to main content
3 of 9
added 159 characters in body
reggie
  • 1.1k
  • 4
  • 14
  • 30

Controlling motion's threshold automatically on my PI

I have motion installed on my pi, and wondered if it was possible to write a python script to change the detection sensitivity to different values for day and night?

The value i'm interested in is called threshold in the motion.conf file.

Would I:

A) edit the motion.conf file, save it and restart motion

B) send the Motion mmaltest a command somehow, maybe passing parameters and getting past the authentication automatically

c) control motion start via cron which iv'e seen here

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

so would this work for threshold threshold in the cron?

0 9 * * * root /usr/bin/lwp-request http://localhost::8080/0/config/set?threshold 1000

----------------------------------------------------------------------------edit below

I try this

http://localhost:8091/0/config/set?threshold=4000 from the command line and i get:

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.

How can i include the username and password in the query string? Iv'e tried:

/usr/bin/wget http:/usr/bin/wget http://localhost::8091/0/config/set?threshold=4000&username=myun&password=mypw

but that didn't work.

reggie
  • 1.1k
  • 4
  • 14
  • 30