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

Dear i updated media_player.py basety.py and androidtv.py.

volume change works from androidtv box to HA
but from HA to androidboxtv
if i drag my volume slider to max or min or 3 steps it just make 1(single) step change in androidtv box.

Here’s my theory.

Let’s say your max volume on your Android TV device is 15, and let’s say that your current volume is 3.

  1. HA does an update and calculates your volume as 3/15 = 0.2.
  2. You slide the volume slider to 0.6 = 9/15.
  3. The set_volume_level sends an ADB command to your device like the one above, which will perform a volume up command every second for a total of 6 volume up commands.
  4. In the component, I tried to tell it that the volume level should now be 0.6 = 9/15. However, I think HA performs an update after sending the set_volume_level command. At the time of the update, the volume has only been bumped once, so HA sees the volume as 0.266667 = 4/15.

I think that if you wait for the next update (maybe 10-30 seconds) and don’t do anything, the volume will then show as 0.6 = 9/15, as desired.

Can you check whether this theory is right. Of course, the actual numbers will depend on what your device’s max volume is. But if you wait and the volume in HA does get updated to what you expect, then that confirms my theory.

I tried,
waited for 30 to 40 secs,
But it changed single step.
If I change volume from min to max or any value in android tv box, it does reflect volume in HA,
But didn’t worked from HA to Androidtv box, moves only single step and not in multiple of steps.

I’m pretty much stumped. You could try:

settings get system volume_music

Note the output in the HA log. Then:

settings put system volume_music 10

Or some other number.

Sources:

How exactly do you do this on Hass.io? Is it not a core component and therefore updatable with a new hass.io version?

Download the contents of this androidtv folder and put them in /config/custom_components/androidtv.

But you can also help by testing out the ADB commands in my previous post using the androidtv.adb_command service.

Updated to hassio 91.0.

I have removed the custom component androidtv. Running Android Debug Bridge - Home Assistant

Getting this error message.

Unable to install package androidtv==0.0.14: Failed building wheel for pycryptodome python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you’ll have pycryptodome 3.8.1 which is incompatible. pyrebase4 4.3.0 has requirement oauth2client==4.1.2, but you’ll have oauth2client 4.0.0 which is incompatible. broadlink 0.9 has requirement pycryptodome==3.4.11, but you’ll have pycryptodome 3.8.1 which is incompatible. Command “/usr/local/bin/python3 -u -c “import setuptools, tokenize;file=‘/tmp/pip-install-y5t2jq0m/pycryptodome/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-cqqy5d69/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-y5t2jq0m/pycryptodome/

1 Like

I’ll fix this.

3 Likes

Same error after updating to 0.91

same error, can we get around this by using it as a custom component again until it’s fixed?

Yes.

Pull request: Remove pycryptodome requirement for Android TV #22552

Code: androidtv

Dear, someone here guide me.
I would like to turn on my androidtv box with broadlink.
How to add custom command in turn on command provided in new config.

:tada: Release v0.3.1

Full Changelog

Changed

  • :arrow_up: Upgrades base image to v3.1.0
  • :sparkles: Adds network port description
  • :hammer: Simplifies add-on code logic

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

1 Like

Not sure when it stopped to work, but does anyone have a woking intent for twitch?
My latest one dont seem to work anymore, all the other ones i have (youtube, kodi and so on) works still.

{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n tv.twitch.android.app/tv.twitch.android.apps.TVLandingActivity"}

It might be since there was an update of twitch to the new GUI on the shield?

I use an app called STBEmu and it has these colored coded buttons that some Android Boxes have on their remote: Yellow, Green, Blue and Red

Anyone knows the codes for these? Tried the following but it doesn’t work…

  - type: horizontal-stack
    cards:
      - type: custom:card-modder
        card:
          type: entity-button
          icon: mdi:disk
          name: "BLUE"
          entity: media_player.shield
          hold_action: none
          tap_action:
            action: call-service
            service: androidtv.adb_command
            service_data:
              entity_id: media_player.shield
              command: "PROG_BLUE"
        style:
          background-color: rgba(56,60,69,1)
          border-radius: 20px
          border: solid 3px rgba(118,185,0,1)
          box-shadow: 3px 3px rgba(0,0,0,0.4)
      - type: custom:card-modder
        card:
          type: entity-button
          icon: mdi:disk
          name: "GREEN"
          entity: media_player.shield
          hold_action: none
          tap_action:
            action: call-service
            service: androidtv.adb_command
            service_data:
              entity_id: media_player.shield
              command: "PROG_GREEN"
        style:
          background-color: rgba(56,60,69,1)
          border-radius: 20px
          border: solid 3px rgba(118,185,0,1)
          box-shadow: 3px 3px rgba(0,0,0,0.4)
      - type: custom:card-modder
        card:
          type: entity-button
          icon: mdi:disk
          name: "RED"
          entity: media_player.shield
          hold_action: none
          tap_action:
            action: call-service
            service: androidtv.adb_command
            service_data:
              entity_id: media_player.shield
              command: "PROG_RED"
        style:
          background-color: rgba(56,60,69,1)
          border-radius: 20px
          border: solid 3px rgba(118,185,0,1)
          box-shadow: 3px 3px rgba(0,0,0,0.4)
      - type: custom:card-modder
        card:
          type: entity-button
          icon: mdi:disk
          name: "YELLOW"
          entity: media_player.shield
          hold_action: none
          tap_action:
            action: call-service
            service: androidtv.adb_command
            service_data:
              entity_id: media_player.shield
              command: "PROG_YELLOW"
        style:
          background-color: rgba(56,60,69,1)
          border-radius: 20px
          border: solid 3px rgba(118,185,0,1)
          box-shadow: 3px 3px rgba(0,0,0,0.4)

I think that because it is an emulation app, you have to map these buttons within the application (settings->configure key maps->BTN_RED to long press 1 etc…) and then use the mapped button for the command

https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_PROG_BLUE

Try using either of the following as the command for blue:

  • 'KEYCODE_PROG_BLUE'
  • 'input keyevent 186'
1 Like

:tada: Release v0.4.0

Full Changelog

This is a general maintenance release that upgrades both ADB & the base image used.

:hammer: Changes

  • :arrow_up: Upgrades add-on base image to 3.1.1
  • :arrow_up: Upgrades adb to 1:8.1.0+r23-5~18.04

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

1 Like

Hi there,

I had adb addon worked but after upgrade to newest HA and Newest ADB addon, it stopped work.

I have error HA log:

Could not connect to NVIDIA TV at 192.168.0.230:5555 using ADB server at 192.168.0.250:5037
Platform androidtv not ready yet. Retrying in 150 seconds.

And on ADB addon there are constantly that messages:

[12:41:12] INFO: Starting the Android Debug Bridge server...
adb I 05-08 12:41:12  4832  4832 adb_auth_host.cpp:416] adb_auth_init...
adb I 05-08 12:41:12  4832  4832 adb_auth_host.cpp:174] read_key_file '/root/.android/adbkey'...
adb I 05-08 12:41:12  4832  4832 adb_auth_host.cpp:391] adb_auth_inotify_init...
[12:51:11] INFO: Connecting to device: 192.168.0.230...
connected to 192.168.0.230:5555
adb I 05-08 12:51:11  4832  4832 adb_auth_host.cpp:467] Calling send_auth_response
[12:51:13] INFO: Starting the Android Debug Bridge server...
adb I 05-08 12:51:13  4872  4872 adb_auth_host.cpp:416] adb_auth_init...
adb I 05-08 12:51:13  4872  4872 adb_auth_host.cpp:174] read_key_file '/root/.android/adbkey'...
adb I 05-08 12:51:13  4872  4872 adb_auth_host.cpp:391] adb_auth_inotify_init…

My config is very simple:

{
"devices": [
"192.168.0.230"
],
"reconnect_timeout": 600
}

What went wrong?

That worked thanks!