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:
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
– platform: androidtv
name: “Nvidia Shield”
com.amazon.amazonvideo.livingroom: “Amazon Prime Video”
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
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
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.
I hope this helps!
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.
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
Is there a way to change channels on say the Kodi PVR client with HA?
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.
Everytime i restart HA i have to accept allow network debbuging.. and save fingerprint. Popup comes like 5 to 10 times. super annoying. Why ?
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?
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?
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.
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.
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.
Could you please include your NR flow export in this article? I’m lazy and it would save me and other readers a lot of time.
“The main problem I found was that the support documents whilst useful, didn’t really bridge the knowledge gap that I had. ”
Totally agree with that ! There are only a a few useful media_player entities, and the androidtv.adb_command. For such an otherwise useful device it feels that there is so much missing.
Your flow comes to the same conclusion I made; namely that:
(a) you can launch and stop apps, and
(b) you can simulate buttons pressed on the remote control
… and that’s it. You can’t control apps (except kodi – using a third HA integration) except by sending keystrokes … which assumes you know where the focus was left.
For example, I can start the 9Now (tv network) app, but not select which live channel or which program to watch. I can start the Netflix app, but not select which user or program to watch. OK, I accept that (1) the APIs for the apps are not controlled by nVidia or Android; and (2) the list of possible programs can be unimaginably long. But I can imagine telling Home Assistant to “play the next episode of “
I wrote that article a fair while back and whilst iit holds true still, since then i’ve dug into a lot more code and flows and various geeky bits and bobs. What I find staggering is the level at which people write documentation these days. It assumes a level of knowledge that I (and I suspect a fair few others just don’t have or can’t apply). Even things like Google. Today I found out I’m being moved from G suite to Google workspace. No problem. Was lucky to have it free for as long as I did (10years or so!). The documentation about administering it is ridiculous. There should be a meme out there…. Written by Devs, for Devs 🙂
Now in answer to your comment re the shield, yeah there’s still so much further it needs to go. I’m shocked frankly that there’s not a more all encompassing integration by now given how supreme the thing is when it comes to playing pretty much anything. I guess true api access would be needed for that, and given that Nvidia can’t even release an android upgrade without borking plex for a significant proportion of the users, I’m not holding out much hope! There has to be something that emerges like a universal marker or some way to bridge the gap. If not now, soon I hope!