Full Nvidia Shield Control using Home-Assistant/Hassio and Node-red

I have recently managed to get full control of my Nvidia Shield in HA/Node-red:

Firstly, you need to switch adb_debug on the shield – there are plenty of videos on youtube to help you do that (usually via developer options etc).

Then you add the following:
https://www.home-assistant.io/integrations/androidtv/

Look here for the intents and the full codes ( https://gist.github.com/mcfrojd/9e6875e1db5c089b1e3ddeb7dba0f304 ), but see my snips below for various examples, as it took me ages to work out how to get from the support pages to actual results:

Firstly, this is what I have in my configuration.yaml

media_player:
– platform: androidtv
host: YOUR.SHIELD.IP.HERE
name: “Nvidia Shield”
adb_server_ip: 127.0.0.1
adb_server_port: 5037
apps:
com.google.android.tvlauncher: “Home”
com.google.android.youtube.tv: “Youtube”
com.amazon.amazonvideo.livingroom: “Amazon Prime Video”
com.plexapp.android: “Plex”
com.netflix.ninja: “Netflix”
com.google.android.tv: “Live Channels”

Once this was all set up, I then proceeded to write some scripts so that I would be able to operate the shield. You can also see the commands I used to test the communication with the Shield.

Service Calls testing the Nvidia Shield Control

Service Calls testing the Nvidia Shield Control

Scripts showing Nvidia Shield Control
Scripts showing Nvidia Shield Control

 

I then went into node-red to see if i could interact with it. After some online support help from Facebook and some trial and error, I managed to get it to work. Again see the snips for details

Full Nvidia Shield Control implemented via Node-red

Full Nvidia Shield Control implemented via Node-red

 

Full Node-red details detailing how to set up the ADB debug service call
Full Node-red details detailing how to set up the ADB debug service call

 

JSON command needed for Node-red Call to go through
JSON command needed for Node-red Call to go through

 

 

This should be enough for you to get going. The main problem I found was that the support documents whilst useful, didn’t really bridge the knowledge gap that I had. I couldn’t go from ADB commands to intents. Eventually after reading many posts and searching various forums I managed to crack it.

If any of you are in the market for an Nvidia Shield or an Android TV I would strongly recommend the Nvidia Shield. I bought the first generation in 2015 and it’s still a beast even today. It’s showing no signs of slowing down and Nvidia are still providing me with OS updates. It really is a great little box.

See below for the most recent variant on Amazon.

Nvidia Shield

I hope this helps!

Comments

  1. Nice article. One thing I find missing is there is no good example of the full process to set this up. Most point to the adb documentation but that doesn’t tell you how to install ADB or connect it to the Shield. Using Python which now seems like the primary vs the Server method.

    1. Really sorry for the delay in coming back to you. Didn’t have comment notification turned on (oops!). So with the set up, were you able to get the debugging switched on the shield?
      Once i switched this on (i remember tapping furiously on the build number for 7-10 times) i then turned on USB debugging.
      There wasn’t really any additional steps re the connect. I added the yaml (as above) and it just found it. That being said, I think i did use my windows pc to test it before hand, but that was using Scrcpy. The details of this are here: https://github.com/Genymobile/scrcpy

    1. Hi Paul, I don’t have Kodi hooked up yet, but when I do, there’s two ways i’ll probably go (I usually have two ways to control in case one falls over). Firstly, check out node-red’s node for kodi here: https://flows.nodered.org/node/node-red-contrib-kodi (you can see examples of it being used in this reddit thread: https://www.reddit.com/r/nodered/comments/9ftggp/control_kodi_with_node_red/). HA can interact this way using the call service functions etc, as I have been using in my blog posts. The second way would be via mqtt (https://github.com/owagner/kodi2mqtt). Again, i’d find it easier going via node-red, but you could alternatively set that up straight in HA.

  2. Everytime i restart HA i have to accept allow network debbuging.. and save fingerprint. Popup comes like 5 to 10 times. super annoying. Why ?

    1. Hi Marcus, I’ve never once actually seen that come up. I switched it on once and i’ve never once had to go back and mess with it since. The only thing i can think of is are you trying to interact with the shield from different IP addresses? i.e. from laptop or from a workstation? I don’t know what capability the shield has to store different keys (rsa?). Whilst my shield has been rock steady for almost 2 years now, i’ve had issues authenticating manually with my mobile phone and adb server (unrelated to home-assistant) in the past. I also found this -http://www.jocala.com/connhelp.html. Whilst this doesn’t relate to HA, I thought some of the trouble shooting steps like plugging the shield in with usb etc might be worth a try?

  3. Why do you need to add the piece of code to the YAML file?
    Home assistant can find it right away, so what is the idea behind the code in the YAML file?

    1. Hi there. I set this quite a while ago now, and I think things might have moved on since. I had all my media players hard coded at the time and just haven’t revisited. I know the integrations methods and general discovery platforms are improved now, I’ve just had no reason to change it.

    2. You need to remember some things in HA have changed since I put that post out. Also at the time of writing I preferred to have everything hard coded as some of the integrations and discovery were a bit flaky. It’s still working fine with the yaml so I’ve got no reason to change it.

  4. A good point to note. Once setup in node red restart your Home Assistant and check ADB – Android Debug Bridge logs to ensure it’s connected. For some reason when ever I made changes in node red it would drop the sync.

Leave a Reply

Your email address will not be published. Required fields are marked *