Skip to main content

HDMI CEC to ADB

Turns off an Android TV using a Raspberry Pi and adb shell commands. Not all Android TVs respect the HDMI "standby" command (even if the HDMI-CEC settings are enabled) and as result, the won't turn off automatically when a standby broadcast message is sent via HDMI.

This package aims to solve that using python-cec / libcec and adb (Android Debug Bridge). When a broadcast standby command has been sent, this program sends an adb shell command to turn off the TV using key input.

Installation

There are a few steps to getting all the pieces working.

Android TV Setup

Turn on your Android TV "Developer Mode" and enable adb debug logging.

Install Raspbian

For this setup to work, you will need a Raspberry PI and will need to complete the guide from PiMyLifeUp. This basically installs a Raspberry PI with Raspbian and cec-client which is required to communicate with HDMI and used by this library.

Copy adb keys

You will need to copy public and private keys to your /home/pi/.android/ folder on the Raspberry PI. These could be taken from any computer were adb is installed. These allow from communication over TCP/IP and to turn off the TV.

Install hdmi_cec_to_adb

Once your Raspberry PI is setup, install hdmi_cec_to_adb and setup a cron to automatically start on boot.

# assuming you have virtualenvwrapper already installed
mkvirtualenv hdmi_cec_to_adb

pip install hdmi-cec-to-adb
# Add the following to your crontab and make sure you use your TV IP Address
SHELL=/bin/bash
@reboot source /home/pi/.virtualenvs/hdmi_cec_to_adb/bin/activate && start_hdmi_cec_monitor --tv_ip_address=192.168.1.99 --adb_key_filepath=/home/pi/.android/adbkey

Release files for hdmi-cec-to-adb 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hdmi-cec-to-adb 0.2
File Size Uploaded
hdmi-cec-to-adb-0.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hdmi-cec-to-adb 0.2
File Interpreter ABI Platform
hdmi_cec_to_adb-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / hdmi-cec-to-adb-0.2.tar.gz

Download URL hdmi-cec-to-adb-0.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cd8cca152c00e42843e2c97405683bcf31447f8762000769b16555fd881431da
BLAKE2b-256 checksum
How to use checksums
b8c0a386db030ee35b4aa47064828f627588b435d90a2a12580565eef83fe528
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.7

Release files / hdmi_cec_to_adb-0.2-py3-none-any.whl

Download URL hdmi_cec_to_adb-0.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6504349a4981c3a0f5b2688d142ab6fde88f99ca708deab18bf59bdf9e2d2f24
BLAKE2b-256 checksum
How to use checksums
f258bd0e7ab06fc53d688cf9a22168dd531e80e3e29209d0d142505f83bb9493
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page