Native support for Android TV / Android devices

very nice plugin :wink:

works great with my philips tv
it starts intents

now iā€™m looking how say
start this serie on netflix :slight_smile:

but very nice thanks to all people who make this component :wink:

Hd Homerun intent ran as a working script

shield_hdhr:
alias: ā€œHD HomeRunā€
sequence:

  • service: androidtv.adb_command
    data:
    entity_id: media_player.nvidia_shield
    command: ā€˜am start --user 0 -n ā€œcom.silicondust.view/.Appā€ā€™

Hi,

If you are trying to start NLziet, this works for me:

  • service: androidtv.adb_command
    data:
    entity_id: media_player.nvidia_shield_3
    command: ā€œam start -a android.intent.action.VIEW -d -n nl.nlziet/.ui.splash.SplashActivityā€
1 Like

I have some weird issues with this component.

Iā€™m running on ubuntu installation with virtual env. After some time or reboot i see in the log:
" Could not connect to Android TV at 192.168.1.5:5555 using ADB server at 127.0.0.1:5037"

Then I run ā€œadb connect 192.168.1.5ā€, then it connects and on the next retry the addon succeeds. What does the component do, it should take care of calling adb connect right?

Hereā€™s my yaml entry
media_player:
- platform: androidtv
name: Android TV
host: 192.168.1.5
adb_server_ip: 127.0.0.1

Got it working by using python-adb with a adbkey instead. Realized that I did adb connect as root and had homeassistant running as another user might have been related.

Hi All,
I have Sony Bravia Android TV and Iā€™m a bit confused what is the better option - to use ā€œnativeā€ Sony component or generic Android. At them moment Iā€™m using Sony component, but one of the problems that I have is - I cannot start applications (by the sample Spotify/ Netflix and etc.). What is your recommendation - to switch to generic one - or to keep using Sony?

The component uses the ADB serverā€™s connection, but it doesnā€™t tell the ADB server to connect / re-connect.

What type of device do you have?

For your current setup with the Python ADB implementation, are you using the built-in component or are you using this custom component? Home Assistant Community Add-on: ADB - Android Debug Bridge

Iā€™m trying to see whether the patch made to the Python adb package that is used by that custom component fixes the connection issues that users with newer devices were experiencing.

Iā€™m on a mibox 3. But then I guess the behaviour was works as designed. But as soon as the homeassistant computer rebooted it would need a ā€œadb connectā€¦ā€, guess that could be put in a start up script. Might be worth documenting. Iā€™m on the built in component, seems stable for now.

Yes, it seems like adb connect is needed. See first post, thereā€™s a link to the script I made when this component started. The idea is that, whenever the box connects to the network, thereā€™s an automation that makes a shell command call, doing the adb connectā€¦

Dear,
great thanks for you androidtv development
as in latest update of hassio 0.94
config/deps are discontinued and will be available in docker.
my point is,

  1. will it effect custom_components dependencies
  2. will custom_components dependencies still available in /config/deps/
    Please guide,
    as i dont understand this, i have asked here
    thanks

Ok, this sounds awesome to me, but Iā€™m having a bit of trouble. I tried searching the thread, but no results for ethernet.
I have three miboxes two are mibox3 and one is mibox4.
All of them have USB to ethernet and no option for network debugging.
If I turn on dev options and USB debugging the USB to ethernet stops working and even if I then go down to networking options and choose USB ethernet (Rndis) it wonā€™t come back.
So is it a requirement to leave the box on WIFI to use this?

Just thinking hereā€¦could I connect via wifi, get the authentication and then go back to ethernet?

Using hassio 0.94 and the ADB hassio addon

Hi, Iā€™m using a Mibox S, the ADB commands work perfectly on my setup. However, I could not open Youtube by using intent service. Hass said ā€œfail to start intent serviceā€.

Can anyone check and give me a suggestion?

Hi,

For the intent, this is the data to send alongside with the service:

{"entity_id" :"media_player.mibox", "command": "am start -a android.intent.action.VIEW -d -n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity"}

You can find more details here: ADB Intents (already posted by @JeffLIrion)

About your remote, would you mind sharing the picture and the lovelace yaml for the postitionning of the buttons ?

Thank you !

Hi Frixx,
Great thanks to your help. The solution works perfectly. Just a question. My navigation buttons seem to have some kind of delay with ADB command (~1s). The Youtube command works perfectly without any delay. Is there any chance you can have a look a the file and find a solution for faster response.

This is the config file you are looking for.
Credit: Ran Sa Mac (not me)

has anyone figured out how to stop the DEBUG logging? i have the logger set to:

  default: info
  logs:
    # xiaomi_gateway: debug
    deconz: debug

but i keep getting this twice every ten seconds:

home-assistant   | 21-06-2019:08:25:54,29 DEBUG    [connection.py:24] Connect to adb server - 127.0.0.1:5037
home-assistant   | 21-06-2019:08:25:54,30 DEBUG    [connection.py:75] b'0021host:transport:192.168.1.129:5555'
home-assistant   | 21-06-2019:08:25:54,30 DEBUG    [connection.py:75] b"014Ashell:dumpsys power | grep 'Display Power' | grep -q 'state=ON' && echo -e '1\\c' && dumpsys power | grep mWakefulness | grep -q Awake && echo -e '1\\c' && dumpsys power | grep Locks | grep 'size=' && (dumpsys media_session | grep -m 1 'state=PlaybackState {' || echo) && dumpsys window windows | grep mCurrentFocus && dumpsys audio"
home-assistant   | 21-06-2019:08:25:54,85 DEBUG    [connection.py:47] Connection closed...

I think that will fix it.

am i interpreting this correctly that if your PR is merged, teh fix will be inherited by homeassistantā€™s component?

Thatā€™s not my pull request. But if/when it goes through and a new version of pure-python-adb gets released, Iā€™ll update the HA component so that the issue is fixed.

Looks interesting, how are you guys connecting to a mibox via adb? I dinā€™t think it supported adb over lan?

[10:32:17] INFO: Starting the Android Debug Bridge server...
[10:32:17] INFO: Connecting to device: 192.168.0.24...
unable to connect to 192.168.0.24:5555: Connection refused

I think this will fix the issue. You can download the files yourself and create a custom component, or you can use the new HACS.

https://github.com/JeffLIrion/ha-androidtv