Skip to content

Android Debug Bridge - Community Hass.io Add-on for Home Assistant

License

Notifications You must be signed in to change notification settings

leranp/addon-adb

 
 

Repository files navigation

Community Hass.io Add-ons: Android Debug Bridge

GitHub Release Project Stage License

GitLab CI Project Maintenance GitHub Activity

Discord Community Forum

Buy me a coffee

Support my work on Patreon

The Android Debug Bridge server program.

About

The Android Debug Bridge (ADB) is a client-server program used in Android application development. This add-on provides the server program and can be used to get full local control over your Android (TV) devices.

Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.

  1. Add our Hass.io add-ons repository to your Hass.io instance.
  2. Install the "ADB - Android Debug Bridge" add-on.
  3. Ensure that your Android device has developer mode and network debugging enabled.
  4. Add the IP addresses of your device(s) to the add-on configuration.
  5. Start the "ADB - Android Debug Bridge" add-on.
  6. Check the logs of the add-on to see if everything went well.
  7. Ready to go!

NOTE: Do not add this repository to Hass.io, please use: https://github.com/hassio-addons/repository.

Docker status

Supports armhf Architecture Supports aarch64 Architecture Supports amd64 Architecture Supports i386 Architecture

Docker Layers Docker Pulls

Configuration

Note: Remember to restart the add-on when the configuration is changed.

Example add-on configuration, with all available options:

{
  "log_level": "info",
  "devices": [
    "192.168.1.123",
    "192.168.1.100"
  ],
  "reconnect_timeout": 90,
  "keys_path": "/config/.androidkeys"
}

Note: This is just an example, don't copy and paste it! Create your own!

Option: devices

Allows you to provide a list of IP addresses (or hostnames) of devices to which the ADB server program connects.

Option: reconnect_timeout

The add-on will try to (re)connect to the listed devices after this timeout has passed. In case one of your devices goes offline and comes back online again the add-on will connect to it within this time setting.

The default is 90 seconds.

Option: log_level

The log_level option controls the level of log output by the addon and can be changed to be more or less verbose, which might be useful when you are dealing with an unknown issue. Possible values are:

  • trace: Show every detail, like all called internal functions.
  • debug: Shows detailed debug information.
  • info: Normal (usually) interesting events.
  • warning: Exceptional occurrences that are not errors.
  • error: Runtime errors that do not require immediate action.
  • fatal: Something went terribly wrong. Add-on becomes unusable.

Please note that each level automatically includes log messages from a more severe level, e.g., debug also shows info messages. By default, the log_level is set to info, which is the recommended setting unless you are troubleshooting.

Option: keys_path

Allows you to provide a custom path to where the private/public key pair is stored. This option is not listed by default and completely optional. If you omit this option, the add-on will generate and store a key pair for you internally.

If the provided directory is empty, the add-on will create a new (fresh) key pair in the specified location. You can also provide your own key pair, which must be named adbkey and adbkey.pub (and stored in the specified location).

The keys_path path must be in either /ssl, /config or /share, subfolders are allowed (e.g., /config/adb/mykeys).

Enabling developer mode on your device

Your device must be running in developer & network debugging mode, to allow this add-on to connect.

To do this, follow these steps on your Android TV device:

  1. Press Home and go into Settings.
  2. Select and press "About" from the Settings menu.
  3. Scroll down to the "Build" information.
  4. Select and click on "Build" several times (6-10 times).
  5. A dialog appears, saying: "You are now a developer".
  6. Press Home and go into Settings again.
  7. Select and press "System Preferences" from the Settings menu.
  8. Select and press "Developer options".
  9. Scroll down to "Debugging".
  10. Turn on "Network debugging".
  11. Done!

Not all devices have the same procedure, so for your device, it might differ a bit. A quick search on Google would probably lead you towards a specific solution for your device.

Integrating into Home Assistant

This ADB add-on can be used with all Android-based devices, and we expect multiple integrations for this to appear in Home Assistant itself.

Integration for the Android TV (Sony, NVidia Shield, Xiaomi Mi Box) media player component, is currently under review by the Home Assistant team and is expected to be part of the Home Assistant core soon.

Nevertheless, you can already use this component by installing it as a custom component in your setup. This addon provide you a custom component that was tested for use with this add-on: custom_components/media_player/androidtv.py

Download that file from this GitHub repository and store the file inside your Home Assistant configuration folder. In case of Hass.io, store it in: /config/custom_components/media_player/androidtv.py. Restart Home Assistant so it can pick up this component.

Note: This is a development version of the Android TV component, and might contain issues.

When the custom component is added to your Home Assistant setup, you can use it like so:

# Example configuration.yaml entry
# Based on adding my NVidia Shield, which has IP 192.168.1.34.
media_player:
  - platform: androidtv
    host: 192.168.1.34
    name: "NVidia Shield"
    adb_server_ip: 127.0.0.1
    adb_server_port: 5037

Useful tips and tricks

  • There is a Chrome Extention/App called "ADB Chrome", which can connect to this add-on and actually sideload apps as well!
  • Using the androidtv component, you can send intents via a service call:
    • Send netflix:// as an intent, to start Netflix on your Android TV.
    • Send twitch://stream/frenck as an intent, to start streaming my stream on Twitch.
    • Send any YouTube URL as an intent, to start streaming a video on YouTube.
  • @McFrojd's Gist with useful intents and lovelace example for a Nvidia Shield Remote.

Known issues and limitations

  • This add-on does support ARM-based devices, nevertheless, they must at least be an ARMv7 device. (Raspberry Pi 1 and Zero is not supported).

Changelog & Releases

This repository keeps a change log using GitHub's releases functionality. The format of the log is based on Keep a Changelog.

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Support

Got questions?

You have several options to get them answered:

You could also open an issue here GitHub.

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We have set up a separate document containing our contribution guidelines.

Thank you for being involved! 😍

Authors & contributors

The original setup of this repository is by Franck Nijhof.

For a full list of all authors and contributors, check the contributor's page.

We have got some Hass.io add-ons for you

Want some more functionality to your Hass.io Home Assistant instance?

We have created multiple add-ons for Hass.io. For a full list, check out our GitHub Repository.

License

MIT License

Copyright (c) 2019 Franck Nijhof

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Android Debug Bridge - Community Hass.io Add-on for Home Assistant

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 84.7%
  • Dockerfile 8.0%
  • Shell 7.3%