Control andoird TV/Nvidia shield?

ill try it thanks…

i’ve the First Gen

Ohh right… Well I’m trying to get my 2nd gen easily controlled…

Hi @nikc0069 , could you please post an example of a command line switch for use with automagic and shield TV?

The thing I specifically don’t get about using a command line switch is that you need to give one command for on and one command for off. If you just want something like “activate plex” then you don’t want two commands, you just want to toggle one command.

Indeed but I don’t think there is a command line toggle. However you can have your off command as go home and sleep or something similar. I’ve actually got a harmony hub now so I just do that. Interestingly it registers as a Bluetooth keyboard. This would be a great addition to hass.

Thanks,

I’m about to try and set this up now. If you’re able to post an example config I’d appreciate it.

Hey @nikc0069! Sorry for asking another question, but this definitely woke the shield from standby? I’m able to activate an app if the Shield is on, but if it’s on Standby then it doesn’t work. :frowning:

I got it to power on by getting the screen to come on for a while. Any idea what automagic option you used for off? There is no obvious function that translates to turning the shield on to standby…

Whenever I’ve triggered an app it’s woken from sleep

How do you simulate a pause/play button through automagic? Had a play but couldn’t find anything that looked obvious?

Not sure as I now use a harmony remote. I’m sure there are key presses that will do that though.

Why don’t you use ADB?

It should be trivial to send the KEYCODE_WAKEUP and then open the Plex app.

The complete script would be:

adb connect <SHIELD_TV_IP>
adb shell input keyevent KEYCODE_WAKEUP
adb shell monkey -p com.plexapp.android -v 500

If you need adb on a Raspberry Pi, get it from here:

Then, just add this to configuration.yml:

shell_command:
  start_plex_shield_tv: 'adb connect <SHIELD_TV_IP> && adb shell input keyevent KEYCODE_WAKEUP && adb shell monkey -p com.plexapp.android -v 500 && adb kill-server'

I just tried this on my RPi3 and SHIELD TV and it works just fine.

Remember you have to first authorize the homeassistant user to access your NVIDIA SHIELD TV with adb, so first run

sudo su homeassistant
adb connect <SHIELD_TV_IP>

And authorize it from the SHIELD TV interface.

2 Likes

Curious, can this be done with the hassio image? it doesnt run raspbian i think? resinOS maybe?
or would automagic be better/easier?

I never used hassio, sorry!

ok thanks, ive bought automagic, and am gonna try that…

hey… so i tried it, and its working nicely, but only when the shield is awake… i cant get automagic to wake up the shield as well…

so i managed to get it working fine, but now im wondering if automagic can send me a state? so if the app (netflix) is open, then it does something to tell home assistant? any ideas?

Thanks
Gersh

anyone can help me getting this to work on hassio please?

Hi, all. I have solved the problem of controlling a Series 2 Shield (works with Series 1 too) and also waking the Shield or launching a Shield app using Python code.

See here: https://github.com/stefan-sherwood/nvidia_shield_remote