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

Do you run any other add-on that might wanna use a port that adb wants?
I run traccar that uses a LOT of ports in the 5xxx range, and have set my adb port to 8037 instead.

no i am just using
mosquito, grafana, influxdb, adb and mariadb.
and from them no addon is using that port

@mcfrojd
could you please help me
i have two youtube apps
the official one my kids are logged into (content restricted)
one called smart youtube tv hooked to my log in

could you please help me find what the command is to launcher from a command so i can add it to my harmony automation

here is what i see on HA

app_id: com.liskovsoft.videomanager
app_name: com.liskovsoft.videomanager

edit scrap that i just noticed its on your glist

thank you so much for keeping it updated :+1:

1 Like

is there anyway to check
available apps,
available commands,
available keys,etc from androidtv with adb?
Please guide,
how can i check for volume to set as volume_set: 8

I implemented media_player.volume_set in this pull request: WIP: Improved volume support for Android TV

Could someone test it out and let me know if it works correctly.

1 Like

It gives config error for androidtv

019-03-30 19:41:25 INFO (SyncWorker_15) [custom_components.androidtv.media_player] Output of command ‘VOLUME_SET: 70’ from ‘media_player.minim8s2’: ‘/system/bin/sh: VOLUME_SET:: not found\n’

Use the media_player.volume_set service.

{
  "entity_id": "media_player.your_android_tv", "volume_level": 0.6
}
1 Like

019-03-30 20:56:04 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1850668432]
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 122, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1138, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1160, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py”, line 188, in handle_service
self._platforms.values(), func, call, service_name
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 314, in entity_service_call
future.result() # pop exception if have
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 330, in _handle_service_platform_call
await func(entity, data)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/init.py”, line 504, in set_volume_level
raise NotImplementedError()
NotImplementedError

And other media options like
Pause, next, and all other options disabled after latest wip files

Also media states not working as expected

It should be fixed now.

i dont find any new changes,
did you already changed it?

I changed a , to |.

https://raw.githubusercontent.com/JeffLIrion/home-assistant/patch-17/homeassistant/components/androidtv/media_player.py

Dear,
I tried your new patch-17 which does shows media options,
but for volume,
when i change on device it does reflect on my HA,
But when changing from my HA it gives me following error

2019-03-31 08:37:34 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1893991728]
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 122, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1138, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1160, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py”, line 188, in handle_service
self._platforms.values(), func, call, service_name
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 314, in entity_service_call
future.result() # pop exception if have
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 330, in _handle_service_platform_call
await func(entity, data)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/init.py”, line 504, in set_volume_level
raise NotImplementedError()
NotImplementedError

@JeffLIrion
what should be the change if
it detects media_session state as none than
detect wakelocks else it detects media_session_state

This should be fixed now. You’ll need to update:

Dear i want to put state_media_session detectection
I am trying to detectec wakelock if media_session_state is none
else media_state_session, but not working as expected
as standard apps are detected with media_session_state and
non standard apps are detected with wake_lock.

    elif media_session_state == 0:
        if wake_lock_size == 1:
            state = constants.STATE_PAUSED
        elif wake_lock_size == 2: 
            state = constants.STATE_PLAYING
        else:
            state = constants.STATE_STANDBY
    else:
        if media_session_state == 2:
            state = constants.STATE_PAUSED
        elif media_session_state == 3:
            state = constants.STATE_PLAYING
        else:
            state = constants.STATE_STANDBY

I updated the state detection. Is the volume control working?

this is error while changing volume with slider

2019-03-31 11:15:15 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1900065264] ‘AndroidTV’ object has no attribute ‘set_volume_level’
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 122, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1138, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1160, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py”, line 188, in handle_service
self._platforms.values(), func, call, service_name
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 314, in entity_service_call
future.result() # pop exception if have
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 330, in _handle_service_platform_call
await func(entity, data)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/androidtv/media_player.py”, line 187, in _adb_exception_catcher
return func(self, *args, **kwargs)
File “/config/custom_components/androidtv/media_player.py”, line 397, in set_volume_level
self._volume_level = self.aftv.set_volume_level(volume,
AttributeError: ‘AndroidTV’ object has no attribute ‘set_volume_level’

Dear in this case it will be like if media_state_session is detected it will take conditions from media_state_session
what i want is if state is detected as media_session_state as none than check for wake_lock,
which will have a good result

        # Get the state from `media_session_state`
        elif media_session_state:
            if media_session_state == 2:
                state = constants.STATE_PAUSED
            elif media_session_state == 3:
                state = constants.STATE_PLAYING
            else:
                state = constants.STATE_STANDBY

        # Get the state from `audio_state`
        elif audio_state != constants.STATE_IDLE:
            state = audio_state

        # Get the state from `wake_lock_size`
        else:
            if wake_lock_size == 1:
                state = constants.STATE_PAUSED
            elif wake_lock_size == 2:
                state = constants.STATE_PLAYING
            else:
                state = constants.STATE_STANDBY

If media_session_state is 0 or None, it won’t enter into the media_session_state block.
If audio_state isn’t idle, it will enter into the wake_lock_size block.