[Deprecated] Native support for Fire TV

I’m getting the same error with HA 0.79.2 when trying to set up firetv for the first time.
I got the adbkey and adbkey.pub in the config/android folder which I have configured in the configuration.yaml file. Everything else seems ok except this error.
Restarting the firetv and my PI3B where HA resides won’t help.
I’m also no programmer so I’m basically copy&pasting from several ressources and hope to get it running with some basic logic thinking :wink:

If you see the line data=rsa_keys[0].GetPublicKey() + b'\0') in your error message, it’s a problem with your key. Please see the section “Issue: Error while setting up platform firetv (with an ADB key)” in the Troubleshooting section of the README.

FYI. I know it’s out of your control but I thought I should give you a heads up. When I upgraded from HA v 0.78.x to v 0.79.2, all firesticks entities disappeared until I physically rebooted each firestick and restarted HA again.

Do you have the corresponding log entries? I know some people have had this issue when upgrading HA, but I don’t know why.

It’s been consistent during the past 4 HA updates. The firetv entities disappear and the log contains what is below. My final cure is just to visit each firestick and do a Settings > Device > Reset and then restart HA. Reboot of PI not required.

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/firetv.py”, line 53, in setup_platform
device = FireTVDevice(host, name, adbkey)
File “/config/custom_components/media_player/firetv.py”, line 91, in init
self._firetv = FireTV(host, adbkey)
File “/config/deps/lib/python3.6/site-packages/firetv/init.py”, line 105, in init
self.connect()
File “/config/deps/lib/python3.6/site-packages/firetv/init.py”, line 120, in connect
self._adb = adb_commands.AdbCommands().ConnectDevice(serial=self.host)
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’,))

Thanks! It seems as if the adbkey file got corrupted. I regenerated it, copied it again and now it works!

@JeffLIrion Thanks you. It works fine

@JeffLIrion I have the media player working well, thank you. Is it possible for me now to send a pause command to my firetv from a script or automation, perhaps using an http command?

Definitely. This should work:

- service: media_player.media_pause
  entity_id: media_player.<your Fire TV>

Thank you sir. Works perfectly. Very appreciative.

I read that this component also works with Android boxes. Is that true?

And just to clarify, do I need to enable adb on my device? I’m guessing yes?

I don’t have an Android box, so I don’t know.

Yes, you definitely need to enable ADB on the device. Setup info can be found in the README: homeassistant_native_firetv/README.md at master · JeffLIrion/homeassistant_native_firetv · GitHub

Can you tell me, where to place the ADB-Key ?
Is the “/config/android/adbkey” an folder in the “/custom_components/media_player” ?

Thanks in advance.

First of all, note that there are two files that you need: adbkey and adbkey.pub.

You can place them anywhere in your configuration folder, just make sure you specify the correct path to adbkey in your configuration.

Hey Jeff,

call me stupid, but I’m standing on the hose. I have the two necessary files in a folder “android” in my configuration directory, this is “/home/homeassistant/.homeassistant”.
What must be the definition in the configuration now?
Only “/android/adbkey” ? This won’t work.

use an absolute path: /home/homeassistant/.homeassistant/android/adbkey
/android/adbkey refers to a folder that probably does not exist in your file root.

hi there,
I’m struggling to get this going - followed steps to get the adbkey but getting a file not found error:

FileNotFoundError: [Errno ADB private key %s does not exist] /volume1/docker/homeassistant/config/custom_components/media_player/android/adbkey

is this the file does not exist / the location is incorrect
OR
is the correct key not present in the file

I’ve got the adbkey from my PC and then copied the adbkey over to the custom_components folder. cant figure out what i’m not doing right.
Any help would be greatly appreciated

Did you copy the adbkey file to the custom_components folder or the custom_components/media_player/android folder?

Thanks for the response. Copied to custom_components/media_player/android

Here is what one of mine looks like:

- platform: firetv
  name: firetv_406_livingroom
  host: "192.168.1.193:5555"
  adbkey: "/config/android/adbkey"

the file is just one folder “android” within the “config” folder where all my .yaml’s are.

1 Like