Skip to content

Latest commit

 

History

History
87 lines (58 loc) · 1.52 KB

README.md

File metadata and controls

87 lines (58 loc) · 1.52 KB

Cec to IR wit libcec

Based on a project from the Homeassistant commuity

Installing

Install dependencies

sudo apt-get install libcec-dev build-essential python3-dev python3-pip git

Clone repo

git clone https://github.com/Josua019/python-cec.git

Build and install

sudo python3 setup.py install

Run

python3 cecwatcher.py

A log file will be created and the console will output relevant information

Create a service

Stop the script with Ctrl+C

Create the file

sudo nano /etc/systemd/system/cecwatcher.service

Paste this:

update the path at 'ExecStart'

# systemd unit file for cecwatcher.py

[Unit]
Description=CEC Watcher

[Service]
ExecStart=/usr/bin/python3 /home/pi/Documents/python-cec/cecwatcher.py
# Disable Python's buffering of STDOUT and STDERR, so that output from the
# service shows up immediately in systemd's logs
Environment=PYTHONUNBUFFERED=1
User=pi

[Install]
# Tell systemd to automatically start this service when the system boots
# (assuming the service is enabled)
WantedBy=default.target

Start the service

sudo systemctl start cecwatcher
sudo systemctl status cecwatcher

Set it up to start on boot

sudo systemctl enable cecwatcher

Fixing issues

If status shows an error try fixing it, run

sudo systemctl reset-failed

and resart the service