Native support for Android TV / Android devices

Got the ADB server working on hass.io on a Raspberry Pi.

Take a look at https://github.com/NoedelVreter/hassio-adb-server-addon
Please report back if it works for you

So, I have added the addon. I then nedd to download some custom component ie https://github.com/a1ex4/home-assistant/blob/androidtv/homeassistant/components/media_player/androidtv.py
and add to custom_components folder?

Or included in home assistant by default?

Yes, you need to put androidtv.py into /config/custom_components/media_player/.

Seems to work great!

How do I add apps not present, for example HBO nordic?

Would below suffice?

apps:
  "hbo": "HBO Nordic"

EDIT: Answering myself. Yes above works! Great, so far no issues!

I can not turn on addon, it gives an error:

Stas Prokopenko:
[s6-init] making user provided files available at /var/run/s6/etc
exited 0.
[s6-init] ensuring user provided files have correct perms
exited 0.
[fix-attrs.d] applying ownership & permissions fixes

[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts

[cont-init.d] 00-banner.sh: executing



Hass.io Add-on: ADB Server v0.1

Setup an ADB server for use with the Fire TV and Android TV components.

parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:44+0200] ERROR ----> Unknown HTTP error occured
From:
parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:45+0200] ERROR ----> Unknown HTTP error occured
By:

parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:45+0200] ERROR ----> Unknown HTTP error occured
parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:45+0200] ERROR ----> Unknown HTTP error occured
parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:45+0200] ERROR ----> Unknown HTTP error occured
parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:45+0200] ERROR ----> Unknown HTTP error occured
parse error: Expected string key before ‘:’ at line 1, column 4
[18:51:45+0200] ERROR ----> Unknown HTTP error occured
/ / HA / SU /

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing

[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing


[18:51:46+0200] INFO ----> You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

  • daemon not running. starting it now on port 5037 *
    ADB server didn’t ACK
  • failed to start daemon *
    error: cannot connect to daemon
    [cmd] /run.sh exited 255
    [cont-finish.d] executing container finish scripts

    [cont-finish.d] 99-message.sh: executing


            Oops! Something went wrong.

We are so sorry, but something went terribly wrong when
starting or running this add-on.

Be sure to check the log above, line by line, for hints.

[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] syncing disks.
[s6-finish] sending all processes the TERM signal.

Hass.io Add-on: ADB Server v0.1?

I am running v1.0.3 of the adb server addon https://github.com/NoedelVreter/hassio-adb-server-addon

Works great.

I am trying to get this to work using https://github.com/NoedelVreter/hassio-adb-server-addon

The adb server add on starts correctly and can connect to the Shield:
Starting up ADB

Found existing private key. Using it.
Server started. Waiting for 30 seconds

Connecting to devices.
connected to 192.168.0.10:5555
Done.

I have put androidtv.py into /config/custom_components/media_player/.

But I am getting this error:

Error while setting up platform androidtv
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/media_player/androidtv.py”, line 166, in setup_platform
from androidtv import AndroidTV
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 13, in
from adb import adb_commands
ImportError: cannot import name ‘adb_commands’

Edit I got it working by reinstalling the Add on ADB server deleting the files in \hassio\config\deps\lib\python3.6\site-packages

Working well so far

I am getting error unable to connect to server
Do I need to delete any files related to old androidtv like adb_messenger, android tv etc

can you please share folders created under /deps/lib/python3.6/site-packages/
as my homeassitant hassio cant install dependencies by its own.
Waiting for your reply

I currently have:
adb_messenger
androidtv
androidtv-0.0.4.dist-info
pure_python_adb_homeassistant-0.1.5.dev0.dist-info

I am not sure that deleting them was the right thing to do but it worked for me with a reinstall of the ADB server add on. Also you must accept the confirmation message on your android tv when the server add on starts.

The confirmation message took some time to arrive on my two mi boxes. So one just have to be patient.

Does your android tv widget shows idle constantly when on,
As on my HA I am seeing idle when it’s on.
Please confirm

I thought I had it setup right, but now I’m getting this error


ERROR (SyncWorker_19) [homeassistant.util.package] Unable to install package androidtv==0.0.4: Failed building wheel for pycryptodome python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you’ll have pycryptodome 3.7.3 which is incompatible. pyrebase4 4.2.0 has requirement oauth2client==4.1.2, but you’ll have oauth2client 4.0.0 which is incompatible. broadlink 0.9 has requirement pycryptodome==3.4.11, but you’ll have pycryptodome 3.7.3 which is incompatible. Command “/usr/local/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-09p1ukhc/pycryptodome/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-o0g9y1my/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-09p1ukhc/pycryptodome/ You are using pip version 18.0, however version 19.0.1 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command. 2019-01-23 16:10:31 ERROR (MainThread) [homeassistant.requirements] Not initializing media_player.androidtv because could not install requirement androidtv==0.0.4

Mine says playing when its playing.

and what shows when its paused
can u share some pics

can you please share
which files have you used and the files under deps related to androidtv.
since androidtv.py cant install dependencies by its own,
Please
thanks in adv

But installing in hassio was no more than installing the addon, adding the android py according to instructions. Starting USB debugging on Android TV device. Confirm the popup on Android TV.

true but not getting dependecies which is my error

019-01-24 14:48:30 ERROR (SyncWorker_8) [homeassistant.util.package] Unable to install package androidtv==0.0.4: Failed building wheel for pycryptodome
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you’ll have pycryptodome 3.7.3 which is incompatible.
pyrebase4 4.2.0 has requirement oauth2client==4.1.2, but you’ll have oauth2client 4.0.0 which is incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you’ll have pycryptodome 3.7.3 which is incompatible.
Command “/usr/local/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-hq5_z_un/pycryptodome/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-3u7ghmux/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-hq5_z_un/pycryptodome/
You are using pip version 18.0, however version 19.0.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
2019-01-24 14:48:30 ERROR (MainThread) [homeassistant.requirements] Not initializing media_player.androidtv because could not install requirement androidtv==0.0.4
2019-01-24 14:48:30 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform media_player.androidtv: Could not install all requirements.

Got the same with hassio 0.85.1 :

Unable to install package androidtv==0.0.4: Failed building wheel for pycryptodome python-jose-cryptodome 1.3.2 has requirement pycryptodome&lt;3.4.0,&gt;=3.3.1, but you'll have pycryptodome 3.7.3 which is incompatible. pyrebase4 4.2.0 has requirement oauth2client==4.1.2, but you'll have oauth2client 4.0.0 which is incompatible. broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.7.3 which is incompatible. Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ezu_6qv8/pycryptodome/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-yruyqxei/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-ezu_6qv8/pycryptodome/

Same here on hassio 0.85.1 :frowning:

Not initializing media_player.androidtv because could not install requirement androidtv==0.0.4

Same error here with dependencies.
Latest HASSIO

Does any of you use Xiaomi gateway?

Because it seems that Xiaomi uses pycryptodome and I don’t really want to break it by uninstalling and re-installing another version
 :no_mouth: