GithubHelp home page GithubHelp logo

markus7017 / androidtv_control Goto Github PK

View Code? Open in Web Editor NEW
28.0 4.0 12.0 12 KB

A bash script providing a bunch of functions to control your TV based on ADB. Target scenario: integration with openHAB.

Shell 100.00%

androidtv_control's Introduction

AndroidTV_Control

A bash script providing a bunch of functions to control your TV based on ADB.

This script provides a rich set of functions allowing to control your Android TV (and other Android based devices like the amazon Fire TV stick - may also work with other Android based device types) . Basicly it uses ADB to send commands to the TV. In case of using it on a Raspberry Pi this means that you have to get and compile ADB for ARM. You also need to enable ADB connections on the TV in the settings menu (developer settings, e.g. FireTV) or running the appropirate java app. Check the Internet for more details. You should set the option to remember the pairing, otherwise you need to allow the connect each time you use the script. A new pairing is required any time you change the "calling device". The target scenario is the integration with openHAB - a smart home gateway, but could also be integrated in any other scenario. I use it to switch on/off the TV, select channels, start NETFLIX etc.

You need to change the script code to reflect your IP setup: tv_ip="192.168.xx.xx" # IP address of the TV (device id 1) tv_mac="xx:xx:xx:xx:xx:xx" # MAC address of the TV (required to wake-on-lan" fire_tv_ip="192.168.xx.xx" # IP address of the Fire TV (device id 2) The MAC address can be obtained from the TVs network settins/status

You could enable using cec-client (requires package cec-utils) to power TV using HDMI and also selecting the HDMI channel for the AVR (in this case you need also to set the hdmi_addr_avr var, see script comment).

NETFIX, TV Guide and Videotext are implemented by starting the appropirate App using ADB (thanks Paul for providing the information).

Depending on the TV model you may need to adjust the way the TV is powered on and off. My requires a sleep and not pressing the power button. This ensures that the TV is switched on when its OFF and switches off when its ON. Using the power button as a toggle will fail once you used the remote to do it manually and openHAB doesn't get informed on that.

Please note:

  • The script reflects my scenario and doesn't have the target to be a universal implementation supporting all types of Android TVs. Is was tricky to get everything running, esp. the fact that the TV is accepting the ADB connection.
  • I'm not a bash expert, so maybe some optimizations and more specific error handling could be supplied.

Looking forward to any contribution. I could also provide some scripts for waking up a Apple-TV or controlling the Telekom Entertain Receiver. If you are interested feel free to cantact me.

You could follow up the following thread in the openHAB community: https://community.openhab.org/t/philips-android-tv/15267/25

HappySmartHoming & have fun, Markus

Usage: androidtv_control.sh [[log | trace | debug]] Run without parameters or --help to get iformation on the usage, check the script for more command line options.

androidtv_control's People

Contributors

markus7017 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.