commit 43b5c20380ebe68b7745937847ab6d51f59a47d7 Author: Andreas Demmelbauer Date: Sat May 30 14:36:57 2020 +0200 first try diff --git a/README.md b/README.md new file mode 100644 index 0000000..1aa5819 --- /dev/null +++ b/README.md @@ -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` + diff --git a/ir-remote-timer.py b/ir-remote-timer.py new file mode 100644 index 0000000..d0d246a --- /dev/null +++ b/ir-remote-timer.py @@ -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) + + + + diff --git a/ir-remote-timer.service b/ir-remote-timer.service new file mode 100644 index 0000000..f623f1e --- /dev/null +++ b/ir-remote-timer.service @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..360fa50 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +py_irsend +schedule +time