Native support for Android TV / Android devices

so I did that and now I’m getting this error…

ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform androidtv
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/media_player/androidtv.py”, line 191, in setup_platform
adb_server_port=config[CONF_ADB_SERVER_PORT])
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 230, in init
self.properties = self.device_info()
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 327, in device_info
btmac = re.findall(BTMAC_REGEX_PATTERN, properties)[0]
IndexError: list index out of range

any ideas?

Have you added the IP’s of your devices to the addon configuration and accepted the authentication dialog?

yeah I’ve done that

Seems we have same issue @Nikiya_Osborn
I’ve upgraded to 0.86.1 tonight and now errors for dependancies are gone but i’ve the same log than you now.

IP added to configuration and debug accept is done also.

Tried also to reset adb auth on my box and restart hassio, accepted again the adb connection but still the same !

1 Like

This is a screenshot playing and pausing youtube on my android box and still ui doesn’t change.
It is stuck at idle even when playing YouTube or any app video.
My Megabix and MiniM8s2 are both same device,
Megabix is connected with Broadlink rmmini 3 and MiniM8s2 with androidtv.py.

Status doesn’t change it keeps on showing idle even when running any applications



Please check and guide, and conform.

@SNoof85 + @Nikiya_Osborn

I had the same issue. I resolved it by updating the /config/deps/lib/python3.6/site-packages/androidtv/__init__.py file on Hass.io with the latest from the Master branch on Github here.

I hope that helps!

4 Likes

I’ll try that this weekend, thanks

Works good ! Thx for the hint !
Now issue is that even when something is playing (VLC ofr instance) it is still idle showing in status.
But my 1st goal was to start applications so it’s fine for the moment.

I have the same problem,
If you solve your problem? Please let us know.

that worked perfectly. Thank you very much.

JeffLIrion’s adb server addon + the androidtv.py + the __init__.py file replacement mentioned above worked for me.
I have a Nvidia Shield (2015) and HassOS 0.86.3

Hassio 0.86.3, was also able to make everything works on MiBox3 and MiBoxS.

I had previously errors with dependencies.

Unistalled and re-installed ADB server, copied the init file and the module seems to work now.

I’m gonna make more tests tonight using the module to check if everything works as expected.

Got this all up and running with a Nvidia Shield TV. Next question is, how can I use the state in an automation? Say when Netflix is paused then turn on the lights?

What android box do u use?

This is a freebox mini 4k (TV player from a french ISP.)
It’s android TV 7.0.1 with some apps preinstalled (mainly IPTV app from this ISP).

I have MiniM8s2,
Marshmallow installed on it,
We both have same problem of not getting current status of android tvbox.
There must be some code difference between generic and branded?

interested too in how to use this component with Nvidia Shield.

Ideally I am interested on turning ON the Shield on the appropriate app (like Netflix or others).

Does it work well?

So far the only thing I have done is get it to recognize the Shield TV. That part works great. Still trying to figure out some automation though :slight_smile:

but it works to turn on a switch that wakes up the shield and run the application, for example, Netflix?

Yes it does!