I have an Android Box with multiple streaming & media-managing apps:
Kodi (For my NAS content)
Netflix
Hulu
XfinityTV (For Live TV)
My question is how can I make the Android Box be seen as a media player entity in order to control playback (Pause, play, fast forward, rewind)? I have it plugged into a smart switch, so I can control the on/off state of it via that switch on my HA interface, but don’t know how to control the media aspects of it since it isn’t an Android TV. It’s basically running Android as a stationary phone. I’d like a non-hacky solution that doesn’t rely on Tasker & Tasker plugins if possible. Hopefully there’s a way to specify it as a media element in my configuration.yaml file?
I think currently there are only hacky ways to do this, if at all. Have a look at this thread, or generally search the forum for android control using adb commands.
Not that I’m aware of. It just isn’t a Chromecast. I think there once was an app that would emulate being a chromecast, but that got removed from the app store since of course Google wants to sell their hardware instead of people just installing a special app to reuse existing hardware.
Hmm, I’m a bit at a loss. See, I don’t really need it to fully imitate a Chromecast. I just need to be able to detect current state (playing, paused, idle)
The problem is, that there is no real playing state. When is the device playing? When Netflix is playing? When Spotify is playing? We know that with the chromecast because it’s just a single “app” where content is streaming to. But with a full Android device it’s not that easy.
Anyway, I still don’t know of an easy way to do what you want to do. The closest thing I know of is the manual adb-stuff I have mentioned above. If that’s not an option for you I think you are out of luck.
Oh, this looks promising! I can’t tell with a simple skim of the component, but does it support the reporting of the “media_player’s” state? Like, will HA be able to report whether it’s playing something or paused, etc? Sorry that I can’t look too much into the component at the moment (I’m on mobile and won’t be near a computer until much later today).
Can we escalate this to get more support behind that PR? This is exactly what I’m looking for. But, if it’s far off from being incorporated I’ll likely try implementing the firetv component and seeing if my Android box works with it.
It’s actually doable, one trick is to check the state of the audio output tracks, if there is audio comming out then the state is playing.
Although I couldn’t manage to get more info, like current playing media metadata. One way I thought about is with the notification system, I don’t if it’s everywhere the same but on my Mibox I have a now playing notification with everything needed. Though I could’t find anything from an ADB command to fetch it. Will continue to look!