Docker HA and adb container....Anyone have this setup?


Recommended Posts

Its been a headache and a half and my last resort is posting on here hoping that someone has this setup and can perhaps provide some assistance.

 

Im using the docker home assistant container and been wanting to use an adb container to connect my android devices to use with the androidtv component. Im using the sorccu/adb from dockerhub. I can provide more info but here is a summary of what im dealing with.

 

When i pull the container and manually connect to my devices with the container console. HA is able to connect np after restart. Only issue is when the container restarts it doesnt remember the devices. My appdata gets backed up every night so, I tried editing the dockerfile and adding a script that would auto connect, however after doing this HA will not connect to it at all even though my android devices are connected. Here is some info of stuff i have setup

https://hastebin.com/tutiliripo.bash

 

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

 

https://androidtv.readthedocs.io/en/adb-setup-documentation/adb_setup.html

Edited by mkono87
Link to comment

If its not created for unraid you need to manually do it.

 

Thats how i did it on the apache container:

 

startet container, copied (cp) /etc/apache2/  to a temp folder reachable from outside, copied that to /mnt/user/appdata/apache2/

set link from /etc/apache2/ to /mnt/user/appdata/apache2/

 

Now u have the config files outside. (i dont know if that is the recommended way to do things, but it works)

 

Maybe you need to chmod 777 it.

Edited by nuhll
Link to comment
If its not created for unraid you need to manually do it.

 

Thats how i did it on the apache container:

 

startet container, copied (cp) /etc/apache2/  to a temp folder reachable from outside, copied that to /mnt/user/appdata/apache2/

set link from /etc/apache2/ to /mnt/user/appdata/apache2/

 

Now u have the config files outside. (i dont know if that is the recommended way to do things, but it works)

 

Maybe you need to chmod 777 it.

I'm not sure you understand what I'm dealing with. There is no config folder needed for this container. the issue after building the container with the script injected using the Add and cmd. The container stops and says path doesn't exist

 

If. I run the container right from docker hub without modifying it and connect my android devices, home assistant can connect. But when I add a script to make it auto connect if the container restarts ha can't connect to it.

 

Sent from my Mi A2 using Tapatalk

 

 

 

Link to comment
6 hours ago, nuhll said:

I dont know your program, if it has no config file, than you cant do it that way, correct.

 

The docker page has some examples how to connect, how you try it?

 

From my understanding you should add these commands to the extra parameter.

See with this it connects on startup
```
#!/bin/sh

sleep 5

DEVICES="192.168.0.206"

echo "Connecting to devices."
for device in $DEVICES; do
   adb connect $device
done
echo "Done."

while true; do
  for device in $DEVICES; do
    adb connect $device > /dev/null 2>&1
  done
  sleep 60
done
```
```
Connecting to devices.
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 192.168.0.206:5555
Done.
```

But HA is unable to connect to it. So I cant catch a break. Im wondering its something within docker (unraid) network settings or something. Both are set to bridge like all my other containers (well expect HA) and the ports are exposed. In theory this should be working
```
Mon Apr 01 2019 11:29:16 GMT-0400 (Eastern Daylight Time)
Could not connect to mike firetv at 192.168.0.206:5555 using ADB server at 192.168.0.50:5037
```

Link to comment
lol, try running both containers in br0 with their own ip adress.
Home assistant has to be run as host or it doesn't work properly with other containers. Been down that road in the past. Il try br0 when I have a chance. What's so funny?

Sent from my Mi A2 using Tapatalk

Link to comment
1 minute ago, mkono87 said:

Home assistant has to be run as host or it doesn't work properly with other containers. Been down that road in the past. Il try br0 when I have a chance. What's so funny?

Sent from my Mi A2 using Tapatalk
 

 

I had many problems with bridge/br0, until i swapped all of them to br0.

 

its a "security" thing that bridged cant talk to host...

Link to comment
 
I had many problems with bridge/br0, until i swapped all of them to br0.
 
its a "security" thing that bridged cant talk to host...
Not sure how that's possible as HA is host and all my other dockers such as influxdb, mariadb, mqtt ect are all bridge

Sent from my Mi A2 using Tapatalk

Link to comment
18 minutes ago, nuhll said:

does it work?

Unfortunately not. I ended up giving up and just made turn have unraid not turn off the container while appdata backup is in progress. So really I would only have to worry about reconnecting devices when the entire server is restarted.

Link to comment
i only know 2 ways for persistent settings 1. extra paremters and 2. config files
This was taken from a docker-compose. Can it be used is extra parameters/post arguments?

command: sh -c "/usr/bin/adbscript.sh & adb -a -P 5037 server nodaemon"

Sent from my Mi A2 using Tapatalk

Link to comment
  • 2 months later...
On 3/31/2019 at 10:24 PM, mkono87 said:

Its been a headache and a half and my last resort is posting on here hoping that someone has this setup and can perhaps provide some assistance.

 

Im using the docker home assistant container and been wanting to use an adb container to connect my android devices to use with the androidtv component. Im using the sorccu/adb from dockerhub. I can provide more info but here is a summary of what im dealing with.

 

When i pull the container and manually connect to my devices with the container console. HA is able to connect np after restart. Only issue is when the container restarts it doesnt remember the devices. My appdata gets backed up every night so, I tried editing the dockerfile and adding a script that would auto connect, however after doing this HA will not connect to it at all even though my android devices are connected. Here is some info of stuff i have setup

https://hastebin.com/tutiliripo.bash

 

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

 

https://androidtv.readthedocs.io/en/adb-setup-documentation/adb_setup.html

 

Hi mkono87,

 

I was wondering if you could take me through how you set up your sorccu/adb docker? I've set mine up but no matter what I do, I cannot get Home Assistant to see it? I was hoping I could get some pointers?

Link to comment
4 minutes ago, Tolumi Adamson said:

 

Hi mkono87,

 

I was wondering if you could take me through how you set up your sorccu/adb docker? I've set mine up but no matter what I do, I cannot get Home Assistant to see it? I was hoping I could get some pointers?

Sure Id be glad to try to help out but won't be available till tonight (after 9est) you on discord? Send me a pm on here and il send you my username. 

Link to comment
  • 1 month later...

 

On 6/10/2019 at 5:53 AM, mkono87 said:

Sure Id be glad to try to help out but won't be available till tonight (after 9est) you on discord? Send me a pm on here and il send you my username. 

 

Is your ADB still running, and do you have instructions on how to set it up on unraid?

Link to comment

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.