[SUPPORT] Android Debug Bridge (ADB) - CorneliousJD Repo


10 posts in this topic Last Reply

Recommended Posts

User @Barny made a modification of a container that has really helped me (and at least a few others out) but it wasn't a template for it. 

I decided to create one along with a support thread.

 

The main purpose for this container is to connect to Android TV or FireTV devices so you can control them and automate them with HomeAssistant.

See here: https://www.home-assistant.io/integrations/androidtv/

 

The actual usage of the container should be fairly straight forward, just make sure to set static IPs or DHCP reservations for your Android TV devices so they don't change.

 

NOTE: @Barny had this is --privileged in the DockerHub, however I am running it without that flag and it's functioning so I've left that out of my template, unless there's a need for it, it will remain excluded here.

Edited by CorneliousJD
Link to post

Hi, I'm trying to workout how to add this integration with the home assistant core unraid app.

 

When I read the official documentation mentions adding via supervisor add-ons.

 

I'm going to try the hassio supervisor, but is there another proper way to use this integration?

Link to post
15 hours ago, Natcoso9955 said:

Hi, I'm trying to workout how to add this integration with the home assistant core unraid app.

 

When I read the official documentation mentions adding via supervisor add-ons.

 

I'm going to try the hassio supervisor, but is there another proper way to use this integration?

So what you would need to do is install this container, and put your devices you're connecting to via IP in the list, like 192.168.1.111:5555,192.168.1.222:5555 on the template (it should have some in there as an example already)

 

You are ideally not using the supervisor, instead you're using HA Core and then you run this as a separate docker container, and you would just use this 

https://www.home-assistant.io/integrations/androidtv/

 

When it asks for ADB server, you pulg in your unraid server IP.

 

  # Use an ADB server for sending ADB commands
  - platform: androidtv
    name: Office TV
    host: 192.168.1.222
    adb_server_ip: 192.168.1.10

Where 192.168.1.10 is the unraid server IP running this ADB container.

Then where 192.168.1.222 is the android TV that you've got the ADB container connected to.

 

HA will send the commands to the ADB server container and it will pass them along to the destination.

The ADB server will keep the connections alive in perpituity as long as the IP address doesn't change.

Link to post

Okay figured out what it needs.

 

Strangely after getting prompt on firetv logs repeat the following and HA log says device isnt connected which is confirmed with below.

Static ip setup and confirmed is still correct.

 

adb I 01-10 13:06:39 8 8 auth.cpp:437] adb_auth_init...
adb I 01-10 13:06:39 8 8 auth.cpp:412] adb_auth_inotify_init...
adb I 01-10 13:06:49 8 17 transport.cpp:283] 192.168.1.222:8009: read thread spawning
adb I 01-10 13:06:49 8 18 transport.cpp:296] 192.168.1.222:8009: write thread spawning
failed to connect to 192.168.1.222:8009

adb I 01-10 13:07:29 8 23 transport.cpp:271] BlockingConnectionAdapter(): destructing
adb I 01-10 13:07:29 8 23 transport.cpp:346] BlockingConnectionAdapter(): not started
already connected to 192.168.1.222:8009
adb I 01-10 13:07:49 8 17 transport.cpp:287] 192.168.1.222:8009: read failed: Success

adb I 01-10 13:07:49 8 17 transport.cpp:695] 192.168.1.222:8009: connection terminated: read failed

adb I 01-10 13:07:49 8 8 adb.cpp:110] 192.168.1.222:8009: already offline
adb I 01-10 13:07:49 8 8 transport.cpp:779] destroying transport 192.168.1.222:8009
adb I 01-10 13:07:49 8 8 transport.cpp:359] BlockingConnectionAdapter(192.168.1.222:8009): stopping
adb I 01-10 13:07:49 8 8 transport.cpp:377] BlockingConnectionAdapter(192.168.1.222:8009): stopped
adb I 01-10 13:07:50 8 9 transport.cpp:271] BlockingConnectionAdapter(192.168.1.222:8009): destructing
adb I 01-10 13:07:50 8 9 transport.cpp:351] BlockingConnectionAdapter(192.168.1.222:8009): already stopped
adb I 01-10 13:07:50 8 26 transport.cpp:296] 192.168.1.222:8009: write thread spawning
adb I 01-10 13:07:50 8 25 transport.cpp:283] 192.168.1.222:8009: read thread spawning
adb I 01-10 13:07:59 8 30 transport.cpp:271] BlockingConnectionAdapter(): destructing
adb I 01-10 13:07:59 8 30 transport.cpp:346] BlockingConnectionAdapter(): not started
already connected to 192.168.1.222:8009

 

Link to post
1 hour ago, Natcoso9955 said:

Okay figured out what it needs.

 

Strangely after getting prompt on firetv logs repeat the following and HA log says device isnt connected which is confirmed with below.

Static ip setup and confirmed is still correct.

 


adb I 01-10 13:06:39 8 8 auth.cpp:437] adb_auth_init...
adb I 01-10 13:06:39 8 8 auth.cpp:412] adb_auth_inotify_init...
adb I 01-10 13:06:49 8 17 transport.cpp:283] 192.168.1.222:8009: read thread spawning
adb I 01-10 13:06:49 8 18 transport.cpp:296] 192.168.1.222:8009: write thread spawning
failed to connect to 192.168.1.222:8009

adb I 01-10 13:07:29 8 23 transport.cpp:271] BlockingConnectionAdapter(): destructing
adb I 01-10 13:07:29 8 23 transport.cpp:346] BlockingConnectionAdapter(): not started
already connected to 192.168.1.222:8009
adb I 01-10 13:07:49 8 17 transport.cpp:287] 192.168.1.222:8009: read failed: Success

adb I 01-10 13:07:49 8 17 transport.cpp:695] 192.168.1.222:8009: connection terminated: read failed

adb I 01-10 13:07:49 8 8 adb.cpp:110] 192.168.1.222:8009: already offline
adb I 01-10 13:07:49 8 8 transport.cpp:779] destroying transport 192.168.1.222:8009
adb I 01-10 13:07:49 8 8 transport.cpp:359] BlockingConnectionAdapter(192.168.1.222:8009): stopping
adb I 01-10 13:07:49 8 8 transport.cpp:377] BlockingConnectionAdapter(192.168.1.222:8009): stopped
adb I 01-10 13:07:50 8 9 transport.cpp:271] BlockingConnectionAdapter(192.168.1.222:8009): destructing
adb I 01-10 13:07:50 8 9 transport.cpp:351] BlockingConnectionAdapter(192.168.1.222:8009): already stopped
adb I 01-10 13:07:50 8 26 transport.cpp:296] 192.168.1.222:8009: write thread spawning
adb I 01-10 13:07:50 8 25 transport.cpp:283] 192.168.1.222:8009: read thread spawning
adb I 01-10 13:07:59 8 30 transport.cpp:271] BlockingConnectionAdapter(): destructing
adb I 01-10 13:07:59 8 30 transport.cpp:346] BlockingConnectionAdapter(): not started
already connected to 192.168.1.222:8009

 

Cool, I was going to say I think you're confusing the add-ons in supervisor with other containers with core. 

 

You should just need HA Core and this docker. There's no other add-on needed but I have mine setup so it can turn on and off my  Android tv and change source, etc like you're after. 

 

Could you post a screenshot of this docker along with your HA configuration.yaml (the relevant part) along with what your unRAID IP and ATV/FTV box IP addresses are? I'll take a peek.

 

 

 

Link to post
8 hours ago, Natcoso9955 said:

See attached including the log output from both containers, im sure its something simple, i just don't have much output from the ADB bridge (well that i understand anyway, hahaha)

 

Thanks.

ADB-HAcore.zip 548.08 kB · 0 downloads

So unraid server IP itself is 192.168.1.129 is that correct?

And the fire TV itself is 192.168.1.222 yes?

 

If so then things look okay but ports are wrong somewhre for sure. 

 

Is there a reason you are not using the default ADB port of 5555? 

either way something is wrong somewhere, in the ADB container you say port 8009 for ADB, and in HA config you are saying port 5009, so there's a mismatch on ports right off the bat.

 

Unlessy you've actually changed ADB ports on the FireTV I'd leave them as default of 5555 in both palces otherwise it likely will not work. 

If you have changed the port then you still have a mismatch somewhere. 

Link to post

Hmmm, i think i changed the port because i had seen that 5009 was an open port and just confused that as being the one needed specifically for Fire TV.

Reverted them both to 5555 and everything is working.

 

you mentioned having it configured to change source etc, any chance you can share the additional code you used for that?

I set it to get_sources but it doesn't seem to be getting all of them.

Link to post
2 hours ago, Natcoso9955 said:

Hmmm, i think i changed the port because i had seen that 5009 was an open port and just confused that as being the one needed specifically for Fire TV.

Reverted them both to 5555 and everything is working.

 

you mentioned having it configured to change source etc, any chance you can share the additional code you used for that?

I set it to get_sources but it doesn't seem to be getting all of them.

I just have it get the default sources, I'm routing my logic via NodeRED to change inputs on a Android TV (built in ATV) - I'm not personally using any Fire TVs.

 

See here though: https://www.home-assistant.io/integrations/androidtv/#apps

 

get_sources boolean (optional, default: true)

Whether or not to retrieve the running apps as the list of sources.

 

apps map (optional, default: {})

A dictionary where the keys are app IDs and the values are app names that will be displayed in the UI; see example below. If a name is not provided, the app will never be shown in the sources list. (These app names are configured in the backend package and do not need to be included in your configuration.)

 

exclude_unnamed_apps boolean (optional, default: false)

If this is true, then only the apps you specify in the apps configuration parameter and those specified in the backend library will be shown in the sources list.

 

    exclude_unnamed_apps: true
    apps:
      com.amazon.tv.launcher: "Fire TV"
      some.background.app:  # this will never show up in the sources list
      another.background.app: ""  # this will also never show up in the sources list

You will want to name apps in your app dictionary list for them to show up too. 

 

Also because the docker conatiner is working that's really as far as I can take it, if you need more support than this I'd suggest the HA forums or discord channel or something, this is really just support for the container running properly on unraid which you've now got. 

 

hope this helps though! 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.