| @@ -0,0 +1,32 @@ | |||||
| ``` | |||||
| sudo apt install git python3-pip | |||||
| ``` | |||||
| ### Clone this repo | |||||
| ``` | |||||
| cd /home/pi | |||||
| git clone https://git.notice.at/redplanet/ir-remote-timer.git | |||||
| cd ir-remote-timer | |||||
| ``` | |||||
| ### install pip modules | |||||
| ``` | |||||
| pip3 install -r requirements.txt | |||||
| ``` | |||||
| ### add systemd service | |||||
| ``` | |||||
| sudo cp ir-remote-timer.service /lib/systemd/system/ir-remote-timer.service | |||||
| sudo systemctl daemon-reload | |||||
| ``` | |||||
| ### Setting up a random remote | |||||
| Use `irrecord` to create a lirc Config file and copy the generated file in | |||||
| `/etc/lirc/lircd.conf.d/your-remotes-name.lircd.conf` | |||||
| @@ -0,0 +1,34 @@ | |||||
| from py_irsend import irsend | |||||
| import schedule | |||||
| import time | |||||
| irsend.list_remotes() | |||||
| def turnAllProjectorsOn(): | |||||
| print("turn all projectors on ...") | |||||
| irsend.send_once('logitech_z906', ['POWER']) | |||||
| irsend.send_once('logitech_z906', ['POWER']) | |||||
| def turnAllProjectorsOff(): | |||||
| print("turn all projectors off ...") | |||||
| irsend.send_once('logitech_z906', ['POWER']) | |||||
| irsend.send_once('logitech_z906', ['POWER']) | |||||
| schedule.every().day.at("21:00").do(turnAllProjectorsOn) | |||||
| schedule.every().day.at("6:00").do(turnAllProjectorsOff) | |||||
| while True: | |||||
| schedule.run_pending() | |||||
| time.sleep(1) | |||||
| @@ -0,0 +1,13 @@ | |||||
| [Unit] | |||||
| Description=Switch projectors on and off | |||||
| After=multi-user.target | |||||
| [Service] | |||||
| Type=idle | |||||
| User=pi | |||||
| ExecStart=/usr/bin/python3 /home/pi/ir-remote-timer/ir-remote-timer.py > /home/pi/ir-remote-timer.log 2>&1 | |||||
| Restart=always | |||||
| RestartSec=3 | |||||
| [Install] | |||||
| WantedBy=multi-user.target | |||||
| @@ -0,0 +1,3 @@ | |||||
| py_irsend | |||||
| schedule | |||||
| time | |||||