Home Assistant Community Add-on: ADB - Android Debug Bridge

Thanks! This issue would be a good place.

No problem. Logs attached to that issue.

I updated the custom component. Let me know if that fixes the issue!

Will do. Itā€™s been running for ~30 minutes now without any disconnects, so it seems to be a significant improvement at least.

Awesome! A good stress test would be to send a lot of commands rapidly. Volume up/down might cause your device to do a power cycle (I donā€™t know why), but the back button should be safe. You can use the androidtv.adb_command service with "BACK".

Thanks for testing!

Iā€™m not in front of the device to verify, but I did spam the hell out of the device using the service and didnā€™t see any errors pop up. Still looking pretty solid.

Good to hear! If you donā€™t experience any issues, Iā€™ll create a new release and submit a pull request to HA later today.

1 Like

Any issues to report? If not, Iā€™ll go ahead and release a new version.

Nope, all good here. Tried with both my Shields and havenā€™t seen any problems yet.

Pull request submitted! https://github.com/home-assistant/home-assistant/pull/27108

Iā€™d love to start playing with indents but Iā€™m stuck getting this working - help please!

Iā€™ve got adb setup on my shield, and I get an on-screen prompt to accept connection and the adb logs say connected but I canā€™t see new android media_player in my developers_tools sections e.g. if I open an op

What am I doing wrong? What aim aiming for to be able to see whatā€™s open on each device like in this video from 11m onwards https://www.youtube.com/watch?v=m4kDsy36x5U

{
  "devices": [
    "192.168.30.20"
  ],
  "reconnect_timeout": 90
}
media_player:
  - platform: androidtv
    name: Living Room
    host: 192.168.30.20
    adb_server_ip: 127.0.0.1
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] adb.sh: executing... 
[cont-init.d] adb.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[17:26:19] INFO: Starting the Android Debug Bridge server...
[17:26:19] INFO: Connecting to device: 192.168.30.20...
connected to 192.168.30.20:5555

You only posted the ADB server log, not the Home Assistant log, so I canā€™t tell what the problem is.

Regardless, Iā€™m trying to push toward the Python ADB implementation approach and away from the ADB server approach because itā€™s easier to debug and handle errors, disconnects, and re-connect attempts. Follow the instructions in this post: https://community.home-assistant.io/t/androidtv-adb-manager-adb-device-is-unavailable-encountered-an-error-when-searching-for-device/140522/2.

Youā€™ll also need to add the adbkey entry to your configuration. The ADB server add-on should have saved a key somewhere, so use that.

1 Like

Thanks. Iā€™ve setup the python method and Iā€™m connected and I can add the (nvidia) media_player but it just says paused all the time.

Iā€™ve tried sending ā€˜GET_PROPERTIESā€™ but I must be doing something wrong e.g. for the prime video app I tried sending the command whilst playing but I get:

volume_level: 0.13333333333333333
is_volume_muted: false
app_id: com.amazon.amazonvideo.livingroom
app_name: com.amazon.amazonvideo.livingroom
source: hdmi
adb_response: null
friendly_name: Living Room
supported_features: 21945

I think itā€™s all working now, as thereā€™s no android errors in my ha logs, I think I just donā€™t know how to detect the states correctly.

I think youā€™re doing something wrong regarding the ā€œGET_PROPERTIESā€ call. Or maybe you just need to refresh the page.

The service call should look like this:

And the result should look like this (note the adb_response attribute):

You can then use that info to define state detection rules that work for your apps and your device, as in this thread: [Testers needed!] Custom state detection rules for Android TV / Fire TV

2 Likes

Sorted - thanks. What was happening was I was selecting the right media_player but when I clicked ā€˜fill example dataā€™ it was changing the player to the wrong one!

I was having this problem with my android phone. couldnā€™t find a solution anywhere until i saw your entry. disconnecting adb was my issue. Thank you so much. :slight_smile:

Did you find the cause of the data length messages?

Hi, my issue was a lack of understanding on how the intents were working. I sorted it when someone sent me an example of one in action. Once I had the basics, it was easy to amend it to my own entities and get it up and running. I can control the Shield direct via HA or via node-red now depending on what I am trying to do.

Hi there all,
and sorry if I reopen this already long thread.

I have already set the ADB component and itā€™s work if I call it from Tools>Services
using POWER and SLEEP data.

Now, in order to use it with google home assistance, I need to make a switch (at last I believe)

I try a lot of combination but this yaml language Iā€™ll never understand :frowning:

So the last think is to ask your helpā€¦
Here is what I want to correct if itā€™s possible to help me:

switch 6:
  - platform: template
    switches:
      tv:   ### TV PHILIPS (192.168.1.157)
        turn_on:
          service: androidtv.adb_command
          data:
            entity_id: 'media_player.philips_tv'
            command: 'POWER'
        turn_off:
          service: androidtv.adb_command
          data:
            entity_id: 'media_player.philips_tv'
            command: 'SLEEP'

I need to name the switch: tv
This in order to ask ā€œhey googleā€¦ turn on the tvā€
Please help me to finish thes script.

Thasks a lot all
Denis

Dear all,
I finally find how to make a switch in order to use it with google home mini
Here is my actual config:

switch 6:
  - platform: template
    switches:
      tv:
        value_template: 'off'
        turn_on:
          - service: androidtv.adb_command
            data:
              entity_id: 'media_player.philips_tv'
              command: 'POWER'
          - service: androidtv.adb_command
            data:
              entity_id: 'media_player.philips_tv'
              command: 'HDMI1'
        turn_off:
          - service: androidtv.adb_command
            data:
              entity_id: 'media_player.philips_tv'
              command: 'SLEEP'

The problem now is that I canā€™t understand how to make the HDMI1
always activate when I power on the TV.
I put 2 times the service and activate HDMI1, but is not work.

Anybody can help me please ?
Thanks in advance
Denis