瀏覽代碼

first try

master
Andreas Demmelbauer 4 年之前
當前提交
43b5c20380
共有 4 個文件被更改,包括 82 次插入0 次删除
  1. +32
    -0
      README.md
  2. +34
    -0
      ir-remote-timer.py
  3. +13
    -0
      ir-remote-timer.service
  4. +3
    -0
      requirements.txt

+ 32
- 0
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`


+ 34
- 0
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)



+ 13
- 0
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

+ 3
- 0
requirements.txt 查看文件

@@ -0,0 +1,3 @@
py_irsend
schedule
time

Loading…
取消
儲存