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

Hi Frenck,

In the configuration.yaml I had set up this:

# nVidia Shield TV in cinema
media_player:
  - platform: androidtv
    host: 192.168.178.133
    name: "shieldcinema"
    adb_server_ip: 127.0.0.1
    adb_server_port: 5037

And in the ADB addon config I have this:

{
  "devices": [
    "192.168.178.133"
  ],
  "reconnect_timeout": 90,
  "log_level": "info"
}

But I’m obviously missing something. Could you give me a hint where to look?

Settings look good, anything in the Home Assistant logs?

The system log you mean? There’s nothing inthere that says androidtv.

I did notice an error:

20-01-09 15:52:48 ERROR (MainThread) [hassio.api.ingress] Ingress error: Cannot connect to host 172.30.33.1:8099 ssl:None [Connection refused]

But don’t know what that means.

And this is what’s in the developer tools log:

020-01-09 16:52:33 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "media_player". Check lines 18 and 27.
2020-01-09 16:52:33 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "input_boolean". Check lines 36 and 43.
2020-01-09 16:52:41 ERROR (Thread-3) [pychromecast.socket_client] [Rune:8009] Failed to connect to service Chromecast-Audio-a31d3a50b071a26c87a6297830728be0._googlecast._tcp.local., retrying in 5.0s
2020-01-09 16:52:41 ERROR (Thread-4) [pychromecast.socket_client] [Dagmar:8009] Failed to connect to service Chromecast-Audio-0c2e204fa1ec05636860d4f2155173fe._googlecast._tcp.local., retrying in 5.0s
2020-01-09 16:59:53 WARNING (SyncWorker_8) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "media_player". Check lines 18 and 27.
2020-01-09 16:59:53 WARNING (SyncWorker_8) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "input_boolean". Check lines 36 and 43.
2020-01-09 17:00:23 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 17:00:30 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 17:00:52 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 17:04:06 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 17:04:10 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 20:18:07 ERROR (SyncWorker_9) [DenonAVR] No connection to /goform/AppCommand.xml end point on host 192.168.178.34
2020-01-09 20:18:07 ERROR (SyncWorker_9) [DenonAVR] Update failed.
2020-01-09 20:43:56 ERROR (SyncWorker_3) [DenonAVR] No connection to /goform/AppCommand.xml end point on host 192.168.178.34
2020-01-09 20:43:56 ERROR (SyncWorker_3) [DenonAVR] Update failed.
2020-01-09 21:44:27 ERROR (Thread-2) [pychromecast.socket_client] [SHIELD:8009] Error reading from socket.
2020-01-09 21:44:27 WARNING (Thread-2) [pychromecast.socket_client] [SHIELD:8009] Error communicating with socket, resetting connection
2020-01-09 22:01:22 ERROR (SyncWorker_4) [DenonAVR] No connection to /goform/AppCommand.xml end point on host 192.168.178.34
2020-01-09 22:01:22 ERROR (SyncWorker_4) [DenonAVR] Update failed.
2020-01-09 22:50:55 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 22:54:06 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command
2020-01-09 22:57:49 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command

I cleaned up my configuration.yaml to fix many of the above errors, but there’s now this error:

Platform androidtv not ready yet. Retrying in 90 seconds.

And just like that… the androidtv.adb_command services appeared in my services menu. No idea what did it though. Apologies for cluttering the list.

1 Like

I’m not sure if this is possible with this setup. But I had it setup with my smarttv so I’d love for it to work with the shield. Is this possible. I turn on netflix and while its on standby my light strip lights up, when I press play it dims and then when I press stop or pause it lights up all the way again? I cant figure out how to specify if its netflix vs hulu or another app. Any help would be greatly appreciated

I’m pleased to be able to report that I’ve managed to get my Sony TV integrated using the PSK plugin. Still looking for a way to see what App is running and to select Apps to run rather than just the channels. I got Netflix to work, but not Spotify or Amazon Prime video

You have to get the ìds for the apps. Take a close and long look at this page, it’s a lot of useful information! :slight_smile:

This is my unfinished media_player.yaml and I’m not using the apps on the TV but on my AndroidTV-Stick, but it doesn’t matter, what androidTV you are using.

- platform: braviatv_psk
  host: !secret host_sony-bravia
  name: Sony Bravia TV
  psk: sony
  mac: !secret mac_sony-bravia
  amp: True
  android: True
- platform: androidtv
  name: MagentaTV Stick
  host: !secret host_magentatv-stick
  adb_server_ip: 127.0.0.1
  adb_server_port: 5037
  apps:
    de.telekom.magentatv.androidtv: "MagentaTV"
    de.swr.avp.ard.tv: "ARD Mediathek"
    com.zdf.android.mediathek: "ZDF Mediathek"
    com.amazon.amazonvideo.livingroom: "AmazonPrimeVideo"
    com.netflix.ninja: "Netflix"
    # YouTube 
    de.rtli.tvnow: "TVNow"
    de.prosiebensat1digital.seventv: "Joyn"
    com.google.android.apps.mediashell: "Chromecast MagentaTV"
    com.android.tv.settings: "AndroidTV Einstellungen"
  state_detection_rules:
    'de.telekom.magentatv.androidtv':
      - 'playing':
          'wake_lock_size': 3
      - 'playing':
          'wake_lock_size': 2
      - 'paused':
          'wake_lock_size': 1
      - 'idle'
    'de.swr.avp.ard.tv':
      - 'playing':
          'wake_lock_size': 2
          'media_session_state': 3
      - 'paused':
          'wake_lock_size': 1
          'media_session_state': 2
      - 'idle':
          'wake_lock_size': 0
    'com.zdf.android.mediathek':
      - 'playing':
          'wake_lock_size': 3
      - 'paused':
          'wake_lock_size': 1
      - 'idle'
    'com.amazon.amazonvideo.livingroom':
      - 'playing':
          'wake_lock_size': 4
      - 'paused':
          'wake_lock_size': 2
      - 'idle':
          'wake_lock_size': 1
    'com.netflix.ninja':
      - 'playing':
          'wake_lock_size': 4
          'media_session_state': 3
      - 'paused':
          'wake_lock_size': 2
          'media_session_state': 2
      - 'idle':
          'wake_lock_size': 2
          'media_session_state': 3
    'de.rtli.tvnow':
      - 'playing':
          'wake_lock_size': 4
      - 'playing':
          'wake_lock_size': 3
      - 'paused':
          'wake_lock_size': 2
      - 'idle'
    'de.prosiebensat1digital.seventv':
      - 'playing':
          'wake_lock_size': 3
      - 'paused':
          'wake_lock_size': 2
      - 'idle':
          'wake_lock_size': 1

The part under apps is for the friendly name, and the state_detection_rules are for the state (idle, playing, pause). As I said, not finished and not 100% accurate, as I still get pause when Joyn is playing… But that’s for another evening to catch! :slight_smile:

1 Like

Hello, I’m having trouble getting Android TV setup, I’ve setup and installed the androidtv component, and adb add-on for hass, but unable to get lovelace card to show local playback from apps, it only works for casting.

Many thanks.

Thank you Patrick, I’ll take a bit of time and read through the info you’ve shared.

I started my Sony TV journey trying to use the androidtv platform, but had problems where it would fail to connect. I’m not sure my TV supports network debugging, but I’ll give it another go.

I started having this same issue about 15 days ago. Configuration was working great for a month+. No changes to config before the service stopped working.

I’ve got this working for some time now. Very nice.

Now I want to start some actions from Node-Red. But the androidtv.adb_command isn’t available in Node Red.
So how do I start an adb command from Node REd?

Hi HA team

I have a new Amazon FireTV Cube and have successfully installed the ADB add-on. Configuration looks good and I am able to connect without issue. I looked through the documentation for ADB but was unable to find the answer:

Is there a way to launch a specific youtube URL or video using the service? Say if I wanted to stream a live channel on youtube on the device.

Thank you team!

Yes , use this script , change with your enitiy name and youtube URL

scriptname:
  alias: scriptname
  sequence:
  - data:
      command: am start -a android.intent.action.VIEW "https://www.youtube.com/watch?v=ZFjfK8piBbQ"
      entity_id: media_player.nvidia_shield
    entity_id: media_player.nvidia_shield
    service: androidtv.adb_command

:tada: Release v0.6.0

Full Changelog

This is a small bugfix/improvement release.

:hammer: Changes

  • :books: Update add-on documentation to use new YAML configuration format
  • :hammer: Update add-on config with new password & list features
  • :hammer: Re-branding
  • :arrow_up: Upgrades add-on base image to v5.0.1
  • :hammer: Update community forum link

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

I have install ADB addon and setup androidtv plateform in configutation.yaml. But I can’t find the adb command in service. What did I miss? Thanks!

Having the same issue, did you ever figure this out?

Try this!
I have followed this component and worked fine.

Hello,

I can’t get the mediaplayer to work in hassio.
There isn’t a mediaplayer created after a reboot.
The addon is installed fine and it is connected to my android tvbox (mibox).
What am i doing wrong?

My settings in the addon:

devices:
  - 192.168.1.80
reconnect_timeout: 90
log_level: info

My configuration.yaml settings:

media_player:
  - platform: androidtv
    host: 192.168.1.80
    name: "MiBox"
    adb_server_ip: 127.0.0.1
    adb_server_port: 5037

Do i have to open a port or something?

The logfiles from the app is all good, connected to 192…

Tnx in advance!

It’s working!
Something stupid from my side!
Did not gave hassio acces on the mibox when adb asked for it…
Screen was off…

Tnx!