dwaan / homebridge-adb

Homebridge script to control remote ADB enabled Android device
MIT License
74 stars 14 forks source link

Nvidia Shield TV pro - unrecognized device #86

Open nseries100 opened 2 years ago

nseries100 commented 2 years ago

--> Still getting error in HB which says Unrecognized device --> In Home app Shield is shown as OFF but should be shown as ON

Device: Nvidia Shield TV pro

adb tcp 5555 without error

homebridge@raspberrypi:/var/lib/homebridge $ adb connect 192.168.1.117:5555
already connected to 192.168.1.117:5555

homebridge@raspberrypi:/var/lib/homebridge $ adb --version Android Debug Bridge version 1.0.39 Version 1:8.1.0+r23-5 Installed as /usr/lib/android-sdk/platform-tools/adb

[03/07/2022, 14:59:24] [HomebridgeADB]

WARNING: Unrecognized accessory - "Nvidia Shield". Please check if the accessory's IP address is correct. If your accessory is turned OFF, please turn it ON.

[03/07/2022, 14:59:24] Nvidia Shield E02F is running on port 32971. [03/07/2022, 14:59:24] Please add [Nvidia Shield E02F] manually in Home app. Setup Code: xxx-xx-xxx [03/07/2022, 14:59:24] Nvidia Shield Playback Sensor 9DE5 is running on port 37683. [03/07/2022, 14:59:24] Please add [Nvidia Shield Playback Sensor 9DE5] manually in Home app. Setup Code: xxx-xx-xxx [03/07/2022, 15:05:32] [HomebridgeADB] Nvidia Shield - Awake [03/07/2022, 15:05:33] [HomebridgeADB] Nvidia Shield - Playback - On [03/07/2022, 15:05:43] [HomebridgeADB] Nvidia Shield - Playback - Off

HomeBridge config: "accessories": [ { "name": "Nvidia Shield", "ip": "192.168.1.117", "path": "/usr/bin/adb", "mac": "48:b0:2d:65:2d:37", "timeout": 1000, "interval": 1000, "category": "TV_STREAMING_STICK", "hidenumber": true, "hidehome": true, "hideother": true, "playbacksensor": true, "skipSpeaker": true, "upbutton": "KEYCODE_DPAD_UP", "downbutton": "KEYCODE_DPAD_DOWN", "leftbutton": "KEYCODE_DPAD_LEFT", "rightbutton": "KEYCODE_DPAD_RIGHT", "selectbutton": "KEYCODE_ENTER", "backbutton": "KEYCODE_BACK", "playpausebutton": "KEYCODE_MEDIA_PLAY_PAUSE", "infobutton": "KEYCODE_HOME", "poweron": "KEYCODE_POWER", "poweroff": "KEYCODE_POWER", "volumeup": "KEYCODE_VOLUME_UP", "volumedown": "KEYCODE_VOLUME_DOWN" } ], "platform": "HomebridgeADB" } ],

RobotLimeLtd commented 1 year ago

tl;dr - the latest version of adb available for Raspbian is out of date and will not authorize. The only workaround at the moment is to run Homebridge on a device for which the latest version is available (Mac, Linux or Windows PC).

Longer explanation...

The message already connected to 192.168.1.117:5555 is a false positive. If you run

adb devices

you will see that your device isn't authorized, and that's the critical thing.

Unfortunately, it seems this is because the version of adb available to Raspbian/Debian is too old, coming from version 28.0.2 of the SDK, when what you need is versiopn 30.x.x or later.

I did get it to work from adb on a Mac, using the version from https://developer.android.com/studio/releases/platform-tools, but adb needs to be run from the device on which you are running Homebridge. If you want to run it from a Rapberry Pi, you're out of luck for the moment. :-(

RobotLimeLtd commented 1 year ago

Ok, I have a workaround/solution for this.

You can install a more recent (latest?) version of adb via Snap Store.

First, remove your local android-tools installation:

sudo apt remove android-sdk-platform-tools-common

Then install Snap ( as per https://snapcraft.io/install/android-tools/raspbian but I will type out the steps in case the link ever disappears):

sudo apt update
sudo apt install snapd

Reboot your Pi, then

sudo snap install core
sudo snap install android-tools --edge --devmode

The path to adb is /snap/bin/android-tools.adb, so you should be able to run

/snap/bin/android-tools.adb connect <ip-address>:5555

If you see errors such as

ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

then

sudo vi /etc/ld.so.preload

and comment out the line /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so

RobotLimeLtd commented 1 year ago

One last set of "gotchas"...

  1. you must add ":5555: to the IP address - you'll have to do this in the Homebridge config file as the plugin's web UI won't let you, e.g.:

    "ip": "10.0.0.16:5555",
  2. You must set the category as "Streaming Stick" e.g.:

    "category": "TV_STREAMING_STICK",
  3. You must set the path to the correct version of adb, e.g.

    "path": "/snap/bin/android-tools.adb",
Homebridge4life commented 1 year ago

Hello @RobotLimeLtd would you be so kind to explain to me like I'm five.

I'm pretty sure my setup is all over the place and probably why your instructions aren't working for me. if you think I would be better off starting my server from scratch idc, I just really want to get my Shield TV in Homekit again like before. Following your steps

1- do I run all of the command in homebridge commmand line? if yes, do I need to change something or run it right from this section? pi@homebridge:/var/lib/homebridge $ or do I log into my Pi directly and do it from there. 2- if the answer was pi I guess I have two users to login. (pi or homebridge) why I don't know.

now after following all your steps I did notice my shield asked for the permission. That is something I've not seen in a long time so that's progress. Thank you! :D

What would you suggest I do?

Homebridge4life commented 1 year ago

@RobotLimeLtd One more thing. What do you mean when you said this? and comment out the line /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so When I follow this, the command is already there. Do I need to delete it or type it again. That is one step I'm missing. Thank you!

SawkeeReemo commented 6 months ago

I’m trying to install this inside a docker container on my raspberry pi since I ran into the same problems everyone else is. In the Homebridge terminal, after installing snapd, when I type snap install core it gives me the following error: error: cannot communicate with server: Post "http://localhost/v2/snaps/core": dial unix /run/snapd.socket: connect: no such file or directory

Any ideas how to proceed?

Mr-Bridge-0 commented 3 months ago

@SawkeeReemo I'm having the same issues too, did anyone ever find a fix for running Homebridge-ADB in a docker container?

SawkeeReemo commented 2 months ago

@SawkeeReemo I'm having the same issues too, did anyone ever find a fix for running Homebridge-ADB in a docker container?

Pardon the lag, I missed your message here. And unfortunately no, there doesn't seem to exist a way to make this work anymore. I've been trying to figure it out for months. I just gave up.