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.
Turns out I forgot to enable “USB Debug” in developer mode. Next question, how can we get the ‘Text to speech’ option to display? It works fine when my android TV shows as a chrome cast but not using the android tv component.
Standard media player
Android TV component
Good day, Did you get this to run reliably?
I set it up and it works, but it seems to connect/disconnect so often that eventually HASS crashes after 1 hour or so in my case.
I am running reliably on the default home assistant integration (https://www.home-assistant.io/components/androidtv/) with the ADB hassio addon (https://github.com/hassio-addons/addon-adb)
Anyone using a mibox and a USB to ethernet network adapter get this to work?
Or is everyone using WiFi?
So you moved to hassio?
Originally you mentioned Unraid
So I assumed you were using HA docker?
@JeffLIrion
I tried your ha-android ,
I found that when my android tv box is turned off the media player ui turns to dark blue
And when it is on or idle it stays sky blue,
Exactly opposite to regular other media player.
Can you please check or any body confirm it.
Thanks
First of all, I don’t think that custom component was working as expected due to how HA now manages the requirements for custom components. I think I fixed it now, but that custom component is really just for testing. You should use the standard component.
If the media player is dark blue when the device is off, that’s probably because the device is completely off (not just sleeping), and so the ADB connection is broken and the media player is unavailable
.
If it’s sky blue when the device is on, that’s probably because the state is Idle
. State detection is a known issue that requires help from the community in order to improve it. In the forthcoming version of the component, there is a fix in the androidtv
package that improves how the media session state property is determined, and that could help with the state detection.
Aside from that, there is an open issue regarding state detection and pull requests are welcome!
Hi, I’ve got the androidtv component working well with my Nvidia Shield.
Just got one question though. Is there a way to increase the poll delay to the device in order to retrieve its state in near real time? Reason is that I want to be able to dim lights on playback and increase their brightness to full on pause, but the time it takes to effect this can be from 1 to around 9 or so seconds. I haven’t timed it multiple times to come up with figures. I would imagine that HA polls the device for its state every few seconds or so. Ideally, it would be great if the API allowed the component to receive state updates in real time.
My android TV integration does’t work after restart. I didn’t change anything TV related just some MQTT sensors, TV is connected to ADB.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/androidtv/media_player.py", line 106, in setup_platform
device_class=config[CONF_DEVICE_CLASS])
File "/usr/local/lib/python3.7/site-packages/androidtv/__init__.py", line 34, in setup
return AndroidTV(host, adbkey, adb_server_ip, adb_server_port)
File "/usr/local/lib/python3.7/site-packages/androidtv/androidtv.py", line 31, in __init__
BaseTV.__init__(self, host, adbkey, adb_server_ip, adb_server_port)
File "/usr/local/lib/python3.7/site-packages/androidtv/basetv.py", line 75, in __init__
self.device_properties = self.get_device_properties()
File "/usr/local/lib/python3.7/site-packages/androidtv/basetv.py", line 232, in get_device_properties
constants.CMD_MAC_ETH0)
File "/usr/local/lib/python3.7/site-packages/androidtv/basetv.py", line 126, in _adb_shell_pure_python_adb
return self._adb_device.shell(cmd)
File "/usr/local/lib/python3.7/site-packages/adb_messenger/command/transport/__init__.py", line 23, in shell
conn.send(cmd)
File "/usr/local/lib/python3.7/site-packages/adb_messenger/connection.py", line 77, in send
return self._check_status()
File "/usr/local/lib/python3.7/site-packages/adb_messenger/connection.py", line 83, in _check_status
raise RuntimeError("ERROR: {} {}".format(repr(recv), error))
RuntimeError: ERROR: 'FAIL' 0006closed
This person had the same error, although his occurred after it had been successfully setup and working for a few hours: Home Assistant Community Add-on: ADB - Android Debug Bridge
It’s probably a bug with the pure-python-adb package. You could submit an issue there.
I fixed the issue by removing the integration, restart, adding and restart and now it works.
As @max5962 mentioned, the usb remote gets deactivated while the usb debugging is turned on which his is very annoying. Is there a workaround for this? Or do you know a different Android TV OS box that doesn’t have this issue? I am using a Mi Box.
And also, the box is somehow disconnecting from wifi while in sleep mode. I tried all the possible solutions to avoid this and none of them worked.
So what is the best way to map all my Nvidia Shield buttons? I used the androidtv custom_component before but now I keep getting: Failed to call service androidtv/adb_command. Service not found.
Hi,
I configured Sony Bravia TV as android TV using ADB add on. It was working ok and since few weeks I have been encountering issues with disconnecting and very slow loading of Android TV entity in UI. What is happening:
-
from time to time TV becomes unavailable even if there are no connection issues in ADB add on logs (it is always connected)
-
when I want to volume down the tv from the entity window (after clicking the 3 dots button) it is loading very slow and all of the buttons become responsive after ~ 15s when the history state is fully loaded. Sometimes it just freezes and remains completely unresponsive. I got below logs in developer tool from time to time:
Updating androidtv media_player took longer than the scheduled update interval
failed to execute an adb command. adb connection re-establishing attempt in the next update. error: error: 'fail' 0006closed
HA version is 0.98.2
ADB add on version is 0.5.2
Has anyone similar issues and know the possible solutions?
Thanks!