Native support for Android TV / Android devices


#102

updated to hass.io .86 and I’m no longer getting that, but now I’m getting this…

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 325, in device_info
properties = self._adb_shell(‘getprop’)
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 477, in _adb_shell_pure_python_adb
return self._adb_device.shell(cmd)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/command/transport/init.py”, line 20, in shell
conn = self.create_connection(timeout=timeout)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/device.py”, line 45, in create_connection
self.transport(conn)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/command/transport/init.py”, line 15, in transport
connection.send(cmd)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/connection.py”, line 77, in send
return self._check_status()
File “/config/deps/lib/python3.6/site-packages/adb_messenger/connection.py”, line 83, in _check_status
raise RuntimeError(“ERROR: {} {}”.format(repr(recv), error))
RuntimeError: ERROR: ‘FAIL’ 000edevice offline


#103

are u using adb_server addon?

if yes than please delete deps folder
and do update/upgrade of homeassistant
and some new files require by androidtv will be installed, and will solve the problem
try and see


#104

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?


#105

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


#106

yeah I’ve done that


#107

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 !


#108

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

image

Please check and guide, and conform.


#109

@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!


#110

I’ll try that this weekend, thanks


#111

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.


#112

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


#113

that worked perfectly. Thank you very much.


#114

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


#115

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.


#116

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?


#117

What android box do u use?


#118

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).


#119

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?


#120

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?


#121

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: