Andreas Demmelbauer před 4 roky
revize
43b5c20380
4 změnil soubory, kde provedl 82 přidání a 0 odebrání
  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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

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

Načítá se…
Zrušit
Uložit