This daemon allows to control HDMI output in Raspberry Pi. It can put monitor to sleep when no nearby movement detected. It can be useful in kiosk applications. Works beautifully with MagicMirror. Requires Passive Infrared Sensor connected to Raspbrerry Pi. Look here for inspirations:
- Raspberry Pi GPIO Sensing: Motion Detection
- How to Interface a PIR Motion Sensor With Raspberry Pi GPIO
- Raspberry Pi Motion Sensor using a PIR Sensor
- Make sure you have all needed components:
sudo apt-get install git
- Clone repository. From
pihome execute:
git clone https://github.com/acejacek/pir_hdmi.git
New folder will appear: pir_hdmi. Navigate into it.
- Test if program works correctly. Check all options:
sudo python pirhdmi.py --help
- Real check. Specify where your PIR is conencted (pin 11 in this example):
sudo python pirhdmi.py --debug --pir-pin 11
If all behaves as expected, interrupt program with Ctrl-C, and follow next step to install service.
-
In
pirhdmi.serviceadjust your setting, specifically--pir-pinto be the same as used in your connection. -
Configure
systemddaemon to run script. Copy service definition to/lib/systemd/systemfolder:
sudo cp pirhdmi.service /lib/systemd/system
- Now, activate the service:
sudo chmod 644 /lib/systemd/system/pirhdmi.service
sudo systemctl daemon-reload
sudo systemctl enable pirhdmi.service
sudo systemctl start pirhdmi.service
- Check the status:
sudo systemctl status pirhdmi.service
- In
pir_hdmifolder execute:
git pull
-
All your customizations can be overwritten. Check again, if
--pir-pininpirhdmi.servicepoints to correct one. -
If you copy updated service definition
pirhdmi.serviceto/lib/systemd/systemfolder, remember to informsystemdabout the changes:
sudo systemctl daemon-reload
- Restart service:
sudo systemctl restart pirhdmi.service