Android Debug Binding (ADB) - Notes for others

I wanted to get OH to control my three Nvidia Shield’s that are Android based TV streaming platforms. Not a lot of information on OH about how to do this.

After spending a few days reading other non OH forums, here’s what I have setup that I hope others can reduce their time finding these things.

  1. Install / setup the Android Debug Binding and connect it manually to each Nvidia unit

  2. Define items (Android Debug Bridge - Bindings | openHAB)

  3. Define the sitemap - which these item mappings work:

Shutdown/Reboot Item :

mappings = [ "NULL"="No Action", "POWER_OFF"="Power OFF", "REBOOT"="Reboot"]

Start Package Item :

mappings = [
  ""="No Action",
  "com.android.systemui/.Somnambulator"="Screen Saver (select twice)",
  "com.netflix.ninja/.MainActivity"="NetFlix", 
  "com.hulu.livingroomplus"="Hulu",
  "com.amazon.amazonvideo.livingroom/com.amazon.ignition.IgnitionActivity"="Amazon",
  "com.plexapp.android"="Plex",
  "com.hbo.hbonow"="HBO Max",	
  "com.apple.atve.androidtv.appletv"="Apple TV",	
  "com.showtime.showtimeanytime"="Showtime",																																			  
  "com.google.android.youtube.tv"="YouTube" ]

Open URL Item (examples):

mappings = [
 ""="No Action",
"https://www.cnn.com"="CNN", 
"https://coin360.com"="Coin 360", 
"https://www.rainviewer.com/map.html?loc=41.9615,-87.7423,8\\&oFa=0\\&oC=0\\&oU=0\\&oCS=1\\&oF=0\\&oAP=0\\&rmt=0\\&c=1\\&o=83\\&lm=0\\&th=0\\&sm=1\\&sn=1"="Rain",	 "http://192.168.0.32:8080/habpanel/index.html#/view/Cameras"="OH Cameras"]
  1. Installing Chrome on Nvidia (which is called side loading)
    Install a downloader from Google Play Store (it’s an orange icon called Downloader)
    Open Downloader and install these in order using the URL’s

       * bit.ly/dlbrp - a browser plugin
       * bit.ly/ccccctv - Chrome itself
    

Now that we know the mappings of item syntax, we can integrate commands via Alexa to control the Nvidia via voice.

Best, Jay

2 Likes

Hey @jwiseman Thanks for this post.

I’m curious if you’ve used the current-package and stop-current-package channels with your Nvidia Shield. From what I can see, current-package is not being populated. And, as a result, stop-current-package doesn’t work.

My debug log shows that the binding is unable to get the package name.

2022-04-09 09:03:49.908 [DEBUG] [droiddebugbridge.internal.AndroidDebugBridgeDevice] - a.b.c.d - shell:dumpsys window windows | grep mFocusedApp
2022-04-09 09:03:49.937 [WARN ] [roiddebugbridge.internal.AndroidDebugBridgeHandler] - Unable to refresh play status: Unable to read package name
2022-04-09 09:03:49.938 [DEBUG] [droiddebugbridge.internal.AndroidDebugBridgeDevice] - a.b.c.d - shell:dumpsys window windows | grep mFocusedApp
2022-04-09 09:03:49.978 [WARN ] [roiddebugbridge.internal.AndroidDebugBridgeHandler] - Unable to refresh current package: Unable to read package name
1 Like

Hey Mark,

I’m actually NOT using either of those items from the SmartJ binding version.

I’m not using stop but instead using the control item for play and pause.

NVidiaBasement_Control.sendCommand(‘PLAY’)
NVidiaBasement_Control.sendCommand(‘PAUSE’)

Here’s the syntax to start a package:

NVidiaBasement_StartPkg.sendCommand(‘com.netflix.ninja/.MainActivity’)

My issue with the binding is the CEC powering on command sequence. My setup is Nvidia → Receiver ← TV. I have an older Samsung TV so sometimes the TV goes on and sometimes it doesn’t. The Samsung BETA binding can shut the TV off but not turn it on. I gave up after spending 8 hours trying to get it to work.

Best, Jay

Ok, thanks.

I’m using the key-event channel for most everything. But I wanted a way to be able to exit (stop) the currently running app. From what I’ve read so far, the method the binding is using to get the current package (mFocusedApp) doesn’t work in all cases. :frowning_face:

Have you found any way to reduce the lag on the adb connection? I’ve made mine connect without issue, and I can send commands, but it’s INCREDIBLY slow. I have noticed that the nvidia shield tv app on my phone is significantly faster which makes me believe that there must be a different/faster way of doing this. It did require a PIN exchange so I’m assuming it’s not ADB related. Thoughts?

Hi,
I’m using the official binding with oh 3.4 on a pi4 with my shield pro as well. The current-package ist still not working, just saying “true” not the name of the package. I think I can live with it, as most of the features can be solved with the variuous key-events. However,
whenever no package is being used I constantly get the log message: Unable to refresh play status: Device does not support media-control. Every 30 seconds…This is probably because the binding is constantly requesting the play status, but there is no package running with any play status. Has anyone an idea how to get rid of that message?
Thanks for your replies!

Have you tried the shieldtv binding? Currently in the market place for 3.4.0 and 4.0.0. PR is pending review currently.

Thanks for the answer, morph!That sounds promissing. I’ll give it a try and report about it in your thread about the new binding.

Best regards!