OpenNetwork.xyz   Placeholder for our stuff related to Telecom, IT, Internet of things (IOT), ESP8266, Raspberry Pi

Raspberry Script to auto turn on and off Monitor Screen using PIR motion sensor

You will need a PIR sensor like this

PIR motion sensor

Make a file named pirMotionDetect1.py

Place the script pirMotionDetect1.py in /usr/local/bin and make it executable

sudo chmod +x /usr/local/bin/pirMotionDetect1.py

Now make another script with name pirMotionDetect.sh. This will start/stop our service at boot time.

Place this file in /etc/init.d and make it executable.

sudo chmod +x /etc/init.d pirMotionDetect.sh

Now we'll register the script to run on boot.

sudo update-rc.d pirMotionDetect.sh defaults

As the script is not running at this time, we'll start it

sudo /etc/init.d/pirMotionDetect.sh start

 

All the best for your site!

 

© 2019 Suresh Hariramani