[Deprecated] Native support for Fire TV

Some people just seem to have these issues. What’s your setup? HA installation type, host system, Fire TV device type(s), etc.

81.4 (81.2 recently) both seeing issues
Synology NAS running Docker

Latest Fire TV and a FireCube

1 Like

My theory is that the people, such as yourself, who have experienced that issue are using faster, more powerful devices for running Home Assistant and so the update function is running ADB commands before the previous ADB command has finished. Please try this version of the component and let me know if it improves / fixes the issue.

1 Like

so not sure if this helps, but reduced to loading a single fire stick.
No error in logs until i turn the TV on start playing something - but does update to 'unknown.
(note the stick is externally powered, but assuming it remains idle until the TV is powered)

play or pause (or any controls dont work), but i do get this in entity attributes:

supported_features: 229665

will switch to the firecube and see if that makes any difference

heya, so possibly stupid question, but given i’m using this on docker, does this install adb?

I’m looking for a way to reboot my wink relays over adb when HA restarts - so wondering if there is a way to use the ADB commands?

This installs the adb python package, which mimics the ADB binaries. If it’s possible to reboot them over ADB, then it’s probably possible to reboot them using the adb python package. I’d suggest experimenting in the python interpreter.

1 Like

awesome - dont suppose you know where adb should be run from?
i’ve only ever used adb from a PC and would just run it from the file location (or add it to %path% variables)

You need to install the Python package: pip install adb-homeassistant. (That contains compatibility fixes not present in the original adb package.) From there, you can follow this README: https://github.com/google/python-adb/blob/master/README.md

1 Like

Thank you, great news (can add this to my dockerfile and install with the build process) :slight_smile: appreciate the help!!

If you’re using Docker then a better solution is probably to install the ADB binaries, which are more robust than the Python package. The advantage of the Python package is that it can be used by Home Assistant and its components. So if you’re going to use the Python ADB package, it might be more efficient to create a HA component than a Docker container.

But if it works as is, then no need to change it!

FYI: these changes got merged into HA (#17767) and should be available in version 0.83!

The latest version of my component does contain a couple minor differences from the merged component; details can be found in the README.

PI3b+, Hass.io v1.12, Supervisor v140, HA v0.82.0
I’m getting this all of the sudden and none of my firesticks are loading:

Log Details (ERROR)

Sun Nov 25 2018 16:35:54 GMT-0600 (Central Standard Time)

Unable to install package pycryptodome==3.6.6: 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.1 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.1 which is incompatible. Command “/usr/local/bin/python3 -u -c “import setuptools, tokenize;file=‘/tmp/pip-install-2wkss62r/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-vzie7rm5/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-2wkss62r/pycryptodome/ You are using pip version 18.0, however version 18.1 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command.

You have a requirement conflict with pycryptodome. My guess is that you’re using another custom component. HA isn’t supposed to even allow less than version 3.6.6 (I believe) of pycryptodome due to a security issue.

Interesting. Looking back at the update histories here, what has changed from then (working) to now (not working) is the upgrade of Supervisor from 139 to 140.

I’ve never been able to get the FireTV component to work. I figured I couldn’t get it to work before when it was a custom component and was hoping this would be resolved when in the HA package but here’s the error I get with 0.83.2. Any ideas what it’s missing?

2018-12-01 15:00:06 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.firetv
2018-12-01 15:00:06 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.firetv
2018-12-01 15:00:08 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform firetv
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/components/media_player/firetv.py", line 63, in setup_platform
    from firetv import FireTV
  File "/Users/mediacenter/.homeassistant/deps/lib/python/site-packages/firetv/__init__.py", line 13, in <module>
2018-12-01 15:00:09 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform firetv
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/components/media_player/firetv.py", line 63, in setup_platform
    from firetv import FireTV
  File "/Users/mediacenter/.homeassistant/deps/lib/python/site-packages/firetv/__init__.py", line 13, in <module>

Line 13 in firetv/__init__.py is (source):

from adb import adb_commands

Try pip install adb-homeassistant and see if that fixes it. You could also try pip install firetv, which should install adb-homeassistant in the process.

Thanks Jeff. I tried both and it says both are already installed. I guess this just won’t ever work for me :frowning: I will try deleting all the dependencies and reinstall and see if that helps

You can try running the same commands that the component does, but from the Python interpreter instead. Modify the variables appropriately and try something like (source):

import firetv

host = '192.168.1.111:5555'
adbkey = '/config/android/adbkey'
f = firetv.FireTV(host, adbkey)

Just upgraded to 83.2 and got new adb keys. Running the above I get:

>>> import firetv
>>> host = '192.168.1.41:5555'
>>> abdkey = '/config/adbkey'
>>> f = firetv.FireTV(host, abdkey)
Traceback (most recent call last):
  File "/config/deps/lib/python3.6/site-packages/adb/adb_protocol.py", line 226, in Unpack
    cls.format, message)
struct.error: unpack requires a buffer of 24 bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/config/deps/lib/python3.6/site-packages/firetv/__init__.py", line 106, in __init__
    self.connect()
  File "/config/deps/lib/python3.6/site-packages/firetv/__init__.py", line 119, in connect
    self._adb = adb_commands.AdbCommands().ConnectDevice(**kwargs)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_commands.py", line 142, in ConnectDevice
    self._Connect(**kwargs)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_commands.py", line 173, in _Connect
    conn_str = self.protocol_handler.Connect(self._handle, banner=banner, **kwargs)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_protocol.py", line 314, in Connect
    cmd, arg0, arg1, banner = cls.Read(usb, [b'CNXN', b'AUTH'])
  File "/config/deps/lib/python3.6/site-packages/adb/adb_protocol.py", line 243, in Read
    cmd, arg0, arg1, data_length, data_checksum = cls.Unpack(msg)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_protocol.py", line 228, in Unpack
    raise ValueError('Unable to unpack ADB command.', cls.format, message, e)
ValueError: ('Unable to unpack ADB command.', b'<6I', b'', error('unpack requires a buffer of 24 bytes',))
>>>

And this:

>>> f = firetv.FireTV(host, abdkey)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/config/deps/lib/python3.6/site-packages/firetv/__init__.py", line 106, in __init__
    self.connect()
  File "/config/deps/lib/python3.6/site-packages/firetv/__init__.py", line 119, in connect
    self._adb = adb_commands.AdbCommands().ConnectDevice(**kwargs)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_commands.py", line 142, in ConnectDevice
    self._Connect(**kwargs)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_commands.py", line 173, in _Connect
    conn_str = self.protocol_handler.Connect(self._handle, banner=banner, **kwargs)
  File "/config/deps/lib/python3.6/site-packages/adb/adb_protocol.py", line 336, in Connect
    data=rsa_keys[0].GetPublicKey() + b'\0')
TypeError: must be str, not bytes
>>>

Any ideas?

I’m not sure about the first error log, but the second one means that your key didn’t work. Did you tell it to “always allow connections from this computer”?