Current best nvidia ShieldTV integration

I have a nVidia Shield TV. It was automatically detected by Home Assistant OS and the “Google Cast” integration installed. From the Developer Tools States I can see what it is playing, and from Services I can turn it on and adjust volume. But I haven’t managed to do anything useful, like turning on TV channel “9now” just before the evening news starts.

I have not used Google casting before, but I understand it uses the destination as a display device - whereas I want to send the shield commands (like a remote control does).

My searches suggest to use the “AndroidTV” integration which requires ADB debugging mode enabled … but other results state that use of debugging mode has been deprecated. Gotta love outdated, incomplete and conflicting search results :frowning:

Would someone who is using a ShieldTV please point me in the direction of the current best-practice approach.

Thanks

I have turned on adb on the shield TV, uninstalled Google Cast and added androidTV to my configuration.yaml. Result is that in HA Configuration, there is NO Device for Media player or Shield TV, but there is a media_player entity.

In HA’s Developer Tools > Services, AndroidTV’s media_player shows a different list of attributes than were exposed by the Google Cast’s media_player. Unfortunately the only useful attributes reported by the androidTV media_player are app_id and app_name … whereas in some apps the Google cast version of media_player also returned media_artist and media_title of the item currently being played.

Using HA’s Developer Tools > Services, I can start an app (eg Netfix or 9Now TV) but is there a way to send commands (other than keystrokes) to an app (e.g. to select which user and go to “My list” in Netflix, or to select which live TV channel within the 9now TV app) ?

I am also trying to see what I can do with my shield tv…. So far have added it using the AndroidTV integration and can now turn it on/off more reliably than with the old google cast.
Does show a screen grab of what is currently on the screen which is cool.
Will keep tinkering as ideally I want some controls to replicate the remote like up,down etc and also some shortcuts to switch to various apps.

Hi Tommy,

Are you wanting to use HA as a remote control for your ShieldTV ? Sounds like you will want to setup some scripts or automations to run off lovelace buttons - or … I noticed a couple of remote control integrations in HACS, but my personal goal is voice-activated automations, so didn’t check them out.

I found media_player.select_source mentioned in the HA AndroidTV integration page works well - but only for netflix and a few other major AndroidTV apps. It says “Simply provide the app ID as the 'source'.” … but it’s obvoiusly NOT referring to the same app_id visible in Developer Tools>State for the ShieldTV (e.g. app_id: it.rainet.androidtv )

However it was right on about using adb_command to send keys (simulating the remote control) …

service: androidtv.adb_command
data:
  entity_id: media_player.shield_tv
  command: DOWN

Problem with keypresses in an automation is that you can’t always guarantee that the cursor is where you expect it to be. For instance my partner sometimes watches her favourite soap on RAIplay (itallian tv) overnight, and just turns the shield off. When my “Watch the TV news” automation fires up at 5:55pm, it assumes the Shield is at the main menu, and well … lets just say LEFT, DOWN, DOWN, ENTER doesn’t always give the Australian TV news :wink:

Cheers,

Try adding the HOME button press first to your automation… That way the cursor should be at the same point everytime your automation runs…

Yes, I have used HOME, and two HOME presses seems to reliably place cursor at the Shield’s main menu from in any app.

Unfortunately the other apps (eg from TV channels and streaming companies) don’t seem to follow consistent guidelines. For example when starting the “9Now” TV app it remembers where you were last and returns to that location. Pressing HOME at that point simply exits the 9Now app and returns to Shield.

So my TV News automation launches the 9Now TV app - but has to give 4x LEFT and 4x UP to (usually) get cursor to top left position

AndroidTV apps rely on there being a human operating the remote control who is watching the screen. I hope one day that developers will provide APIs for their apps.