Article 5HANE how to detect with a bash script if a raspberry pi motion was detected with a movement detection sensor?

how to detect with a bash script if a raspberry pi motion was detected with a movement detection sensor?

by
floppy_stuttgart
from LinuxQuestions.org on (#5HANE)
Hello,
I have a raspberry PI with camera for motion detection. All fine so far: it send mails with photo and store a video when motion is detected (a bash command line in the motion configuration file make this).

When the sun is hiding/appearing, my camera detect motion too. The idea now is to use another sensor in parallel for detecting any physical movement and filter that sunlight (or nights the headlamps from cars around the house).
I could use this sensor http://raspberry.tips/raspberrypi-tu...ry-pi-auslesen in parallel to the camera motion detection.

Now the question is: 1. how to set an environment variable in a python script or 2. how to ask the status of an GPIO via a bash command?

1.
a) inside the python script. how?
b) check it outside the script. how?
for example in the python script sensor_high=1 (how to define this as global bash variable?)
for example outside the python script .. && $sensor_high==1 && etc. ?

2.
Or perhaps the variable is not necessary to be set as global environment variable because the bash could ask directly the GPIO pins was high the last minute probably with a separate script as cron job like

cron script
while 1
if GPIO.input(7)==1 then
$High = 1
wait 60

bash command in motion.conf
..(GPIO.input(7)==1 || $High==1) && etc.

Any advices are welcome (I am still searching in parallel).latest?d=yIl2AUoC8zA latest?i=brHsvd2xg90:Xm8IFhIp6zc:F7zBnMy latest?i=brHsvd2xg90:Xm8IFhIp6zc:V_sGLiP latest?d=qj6IDK7rITs latest?i=brHsvd2xg90:Xm8IFhIp6zc:gIN9vFwbrHsvd2xg90
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments