I’m not suing the ADB server addon, I’m rolling my own container solution with a home assistant instance and added an adb server container.
I’ll do research in trying to find the current state. Thanks for the insight.
I’m not suing the ADB server addon, I’m rolling my own container solution with a home assistant instance and added an adb server container.
I’ll do research in trying to find the current state. Thanks for the insight.
There’s a service known as “media_session” which has attributes for each running app.
One of them is PlaybackState, which has a state attribute which is 3 only while playing.
I don’t really have any firesticks to test on but I’ll make a PR which uses this to detect if its playing, with no other alterations
I probably should have written up my previous investigation on this already, but this is indeed the proper way to handle the states (I was thinking about having a simple app to track the states and do push updates to homeassistant). The problem at that point was (it may have been a year since I looked at it last time) that many of the apps do not use the media session (my experiences on Kindle FireTV stick) for controlling even when the API has been there since Android 4.0.
The description and the integers for states can be found from https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getState() and more documentati on media session here https://developer.android.com/guide/topics/media-apps/working-with-a-media-session .
Thanks for the info! I recall reading something similar, perhaps for the Android TV component: there is an API for determining playback state, but many apps don’t adhere to it.
I believe the Android TV component tries to accomplish this task of state detection by using info about the audio output. If you’re interested, you could look at the component that I’ve previously linked to or the thread in this forum.
My opinion is that it’s not reasonable to expect the component to always detect the correct state. (But if someone wants to try to achieve that, their efforts are certainly welcome!) I also don’t think that differentiating between playing, paused, and idle states is a big deal, at least not for my use cases. The component can detect whether it’s on/off, send basic commands (most importantly power on/off and play/pause), and launch apps. That’s good enough for me
Basic support is fine, I’m not arguing on that, however, having the ability to, e.g., control the lights based on the play state is somewhat popular application I just wanted to leave the note behind in case someone is digging already on the topic or wants to improve it, unfortunately I have personally no time to further it at this point.
Is it possible to add HDMI switching? Running it with the adb shell command wont work.
I have latest version of Fire TV stick and did not get pop-up “always allow connections from this device.”
And I also do not have it as Media control entity in my HA
Is it possible to integrate this with the new official adb hassio addon by @frenck
I am using the androidtv custom_component with official adb addon by Frenck (Community Hass.io Add-on: ADB - Android Debug Bridge)
Stability of connection is amazing.
The official FireTV component didn’t work for me. Always showed Unavailable (with one or two state changes in b/w)
AndroidTV custom_component doesn’t seem to be recognizing play/pause/idle or the current track playing on FireTV cube.
Would be amazing if stability of adb addon can be combined with firetv specific code?
Thanks
@JeffLIrion Is there any functional difference between the firetv and the androidtv custom component?
I just posted this in two other threads, but here it is again.
Regarding the Fire TV component, this is already implemented in my custom component. I’m working on getting it integrated into the official component.
Configuration example:
media_player:
- platform: firetv
name: Fire TV
host: 192.168.0.111
adb_server_ip: 127.0.0.1
Comparing the Fire TV and Android TV components, I haven’t tried the Android TV component, but there are some device-specific tweaks and so I expect that each component will work better for its intended devices.
Reposting here for others. Original comment: Home Assistant Community Add-on: ADB - Android Debug Bridge
Awesome. Working well with new addon.
Will keep testing and report back.
recognizes Home as Standby so that’s good. On opening Netflix recognized app as Netflix, and showed Paused. However on playing, state remained Paused.
Will try out with other apps as well. Thanks a lot for the amazing work.
@JeffLIrion
I’m getting the same as @forums2012 above.
Remains in paused state when app is open and playing, though it doesn’t seem to recognise Plex, nor does it pull a list of apps.
State detection has its limitations. It can’t always determine playback status accurately.
As for the list of running apps, please delete any firetv
and firetv*
folders in the deps
folder in your configuration directory and then restart Home Assistant. This will cause it to install the latest version of the package from GitHub. Please let me know if that fixes the running apps!
Ahhh cheers.
Well, after doing that it picked up the Plex app, so that’s progress.
Can select Plex, play, pause, forward, back.
Can’t power on though. Ah well. May require a little more figuring out on my end.
I just updated my firetv
fork, so if you repeat the same steps from earlier the turn_on
function should work.
firetv
repo.Gotcha. That worked. Can now turn on via the component.
Looks like it’s just picking up whatever app it first detects.
Eg
if the firetv is off when I restart hass, when it turns it on it detects the home.
If the firetv is on with an app open when I restart hass, it just detects that app in sources.
Deps were cleared after updating the component
Edit: sorry for using the forum for issues
It should get a list of whatever apps are running, which it will show as sources. Does it not do that?
Afraid not.
tested with no apps running, restarted hass, and it just saw the launcher.
Tried with multiple apples running, restarted hass, and it only had plex in the list (though multiple were running but i was at the launcher)
I am running using an adb server rather than built in if that helps