JeffLIrion / homeassistant_native_firetv

43 stars 16 forks source link

ADB Key on Hass.io #14

Closed daniel-matthews closed 5 years ago

daniel-matthews commented 5 years ago

Hi,

I'm trying your custom component on hass.io - I'm guessing its not possible to get the adb key from hass.io as connecting via the adb binary is difficult?

Thanks

JeffLIrion commented 5 years ago

This component certainly works with Hass.io. However, you need to provide the adbkey and adbkey.pub files yourself. Generating those key files is beyond the scope of this component.

It might be possible to SSH into your Hass.io instance, download the ADB binaries, connect to the Fire TV and in doing so generate the key files. But that seems way more difficult than just using the ADB binaries on a different computer.

daniel-matthews commented 5 years ago

Thanks - understood. I'm having some issues transferring my ADB key. Im getting 'TypeError: must be str, not bytes' when I try with the created adbkey file. I used the adb binaries on a second pi and transferred the files.

JeffLIrion commented 5 years ago

The 'TypeError: must be str, not bytes' error message almost certainly means that your key is not authenticated. Try connecting from your pi with the binaries and make sure you check the "always allow connections from this computer" box that appears in the Fire TV. Then the component should work.

daniel-matthews commented 5 years ago

Thanks. Ive had that dialogue and all connects fine when using the original Pi with the binaries installed (these keys come from the equivalent component on a competing home automation system that has been working well for months). I'm guessing I need to wait for this pop up again now that Ive moved them to a new system? Connecting directly from hass.io isnt doable sadly.

JeffLIrion commented 5 years ago

You authenticate the key, not the system. When you connect again using that key, the Fire TV remembers it and does not prompt you about whether you want to connect. More details can be found here: https://developer.amazon.com/zh/docs/fire-tv/connecting-adb-to-device.html

Out of curiosity, what alternative home automation system are you referring to and what is the component?

JeffLIrion commented 5 years ago

I don't know how that other system/component handles authentication, but if you follow the instructions in the link from my previous post, it should work.

daniel-matthews commented 5 years ago

Domoticz running on Raspbian. I'm using a bash script I wrote myself that connects using the ADB binary. I actually made it by reading the source of the original home-assistant component and replicating the parts I wanted. Its been working well. I'm currently running both systems side by side and moving a piece at a time to home assistant.

I've copied the ABD Key files it created over to hass.io but no joy it seems (Ive also disconnected the original component and restarted the stick). I have ADB installed on a windows PC too so will give that a go next and see if I get the same result. Thanks for your help - much appreciated.

daniel-matthews commented 5 years ago

Using windows rather than a pi to generate the adb key seems to have worked for me. Thanks for your help.

JeffLIrion commented 5 years ago

That's odd that using the key generated by the Pi didn't work, but I'm glad you got it resolved!