Native support for Fire TV


#203

You should also try restarting your Fire TV device(s). ADB can be kinda finicky about only connecting with one computer, and restarting the device seems to reset this.


#204

Just tried the latest pure python adb firetv.py and got constant connection errors, went back to the debugging version and no problems.


#205

That’s odd, I think the code is almost the same, minus the debugging log statements. Are you using get_sources: false in your configuration? I think that’s the only real difference – the “pure-python-adb” version will try to get the running apps unless you set get_sources: false, but the “pure-python-adb-debugging” version will not.


#206

Thanks a lot for the pointers - I’ve tried all of these and am still struggling.

The full path to my config folder on my Ubuntu Hassio host is /usr/share/hassio/homeassistant/ and I have firetv.py in /custom_components/media_player under the homeassistant directory.

I get the same error messages re ADB no matter if the adbkey files are in the specified location or not and have tried the following variations in my config for the adbkey path:

/homeassistant/android/adbkey
/homeassistant/android/
/hassio//homeassistant/android/adbkey
hassio/homeassistant/android/
usr/share/hassio//homeassistant/android/adbkey
usr/share/hassio//homeassistant/android/

I think I may go and have a play with something else and will revisit this another time :slight_smile:


#207

How about

/usr/share/hassio/homeassistant/android/adbkey

The full path should start with a /. And since it is supposed to be the path to the adbkey file, not folder, there should not be a trailing slash. There must also exist the file <your_adbkey_path>.pub. FYI, the reason why I’m focusing on the adbkey path is because HA checks to make sure that the two key files exist and won’t setup the component if they don’t. Since it tries to setup the component, my theory is that you are providing a relative path and HA is able to find the files, but the component expects a full path and does not find them.

Also, you’re not connecting to your Fire TV using the ADB binary via adb connect <ip_address>, right? Since you did that already and generated the key files, you do NOT want to do that again. The Fire TV only allows one connection, and you want that to be the one from the Python adb package used by this component.


#208

@Picnic, did you try the latest “pure-python-adb” version with get_sources: false in your configuration? And did you remove firetv* folders from your /config/deps/** folders?

I think the latest “pure-python-adb” version is effectively equivalent to the debugging version, and I’d be perplexed if they behave differently.


#209

Update for Hass.io users with ADB issues

I got the ADB server addon to install, and now it needs testers!

Step 1: the component

You’ll need to use this version of the component: firetv.py. The configuration should look like:

media_player:
  - platform: firetv
    name: Fire TV
    host: 192.168.0.111
    adb_server_ip: 127.0.0.1

Step 2: the addon

Install and configure the addon. All the necessary info can be found in the README.

Step 3: start the addon

Step 4: restart Home Assistant


#210

I will test this. I will get it setup a little later. I have 3 fire devices. I can get 2 of the 3 working correctly most of the time. I have tweaked the component to send a home key press to power on from Idle. This triggers the HDMI CEC to power on the actual TV. Also I have also thought of this another way. And I have done a quick Qpython script running in the background on firetv. If someone could create a background service apk that runs in background of firetv and runs a local webserver with API. you can query for status and available sources, and launch apps…


#211

That’s good to know about the Home command! I referenced your post in this GitHub issue.

The component can already launch apps, just use the media_player.select_source service and provide the app name. And with the latest version of the custom component from the “pure-python-adb” branch you can send custom commands via the media_player.firetv_adb_shell service; see the issue linked above for more info.

The addon doesn’t work in its current state, but if you’re able to fix it that would be much appreciated!


#212

I’ll reply on the GitHub Issue. I’m aware it will launch apps via ADB.

My thought for the background app on the fire tv was to remedy the connection issues I have had keeping the FireTV’s online in HA. I am not well versed in JAVA to approach this. just a thought I have had in the past playing with python in android.


#213

I misinterpreted your post – the Fire TV component used to work by sending REST commands to firetv-server, which is an http server that allows you to interact with a Python 2 environment running the firetv package. I thought that’s what you were referring to.

Once it works, I think the Hass.io ADB server addon will fix the connection issues that people encounter.


#214

Tried latest pure python with the following config and no errors:
media_player:

  • platform: firetv
    name: Fire TV
    host: 192.168.1.97
    adbkey: “/config/adbkey”
    get_sources: false

Also tried the addon but it won’t install.


#215

That’s good to hear!:+1:

Yeah, the addon doesn’t work… I need some help from someone who knows more about Docker/Hass.io addons than me!


#216

Is there a way to disconnect the connection so that I can use adb from another source?
I’ve just been editing my config and restarting HA.


#217

This is a great idea. @JeffLIrion i have been toying around with some ideas. Nothing put together yet. I have very little experience with Docker and hassio addons as well. @Picnic i want to add a feature like this to drop the adb connection from HA so it can be used else where. Also for current app state i use the aptoide api to return the friendly app names and icon png based off of package name. My though is the state to show the app instead of generic playing when in app… just thoughts i have come up with and trying to get time to make some process on it…


#218

@Picnic and @chodyjones, the ability to disconnect and reconnect is an interesting idea, but I’m not sure how best to implement that. You’re welcome to submit a PR to either HA or my custom component!

@chodyjones, I don’t think HA would approve of using the app name as the source. But I believe the Android TV component (not yet merged) uses the app_id and app_name properties to do what you want.