I don’t have any amazon hardware to test with, but could it be that when you changed your wireless band that your router assigned a different IP address?
I still have issues with this and have to reboot my android TV boxes every now and then to see them again even though the still have the same IP. Not sure if this is an ADB thing or what, but they come back after a power cycle.
Is it possible to slow-down the screen shot generation period? I love the feature that the entity picture gets updated with current screen, but it updates every 5 seconds or so, which causes the media player icon to flash (I use mini-media player, but same behavior in default media control card).
I am using a FireTV stick with the built-in python adb
I found as of a recent Fire TV update, that my Insignia Fire TV edition seems to be using Android’s Doze function. After I turn the tv “off” (which used to just put it in in a ‘soft’ standby mode with full network connectivity), the tv will disconnect from the network after about 5 minutes, won’t even respond to ping, and when I power it back on it turns on to the boot screen before waking rather than just waking like it used to. In my Unifi router controller I see that it is showing it’s in Powersave mode during this time. I’ve found that at regular intervals the Fire TV will wake for a period of time and then drop network again, likely checking in with Amazon servers.
As an attempt to fix this myself, I’ve tried to use adb commands to set the sleep time to 0. I’ve tried to sideload the wakelock app, however the Android Doze function is not effected by wakelock. Next I’m going to try to see if I can disable Doze via adb shell commands, and/or see if responding to ping will keep the Fire TV from sleep, then just keep a ping going at regular intervals.
Since yesterday i get suddenly these errors and my android box tv is in unavailable state:
2020-04-12 21:50:41 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up androidtv platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), 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 213, in setup_platform
state_detection_rules=config[CONF_STATE_DETECTION_RULES],
File "/usr/local/lib/python3.7/site-packages/androidtv/__init__.py", line 44, in setup
return AndroidTV(host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, auth_timeout_s)
File "/usr/local/lib/python3.7/site-packages/androidtv/androidtv.py", line 40, in __init__
BaseTV.__init__(self, host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, auth_timeout_s)
File "/usr/local/lib/python3.7/site-packages/androidtv/basetv.py", line 100, in __init__
self.device_properties = self.get_device_properties()
File "/usr/local/lib/python3.7/site-packages/androidtv/basetv.py", line 206, in get_device_properties
constants.CMD_MAC_ETH0)
File "/usr/local/lib/python3.7/site-packages/androidtv/adb_manager.py", line 435, in shell
return self._adb_device.shell(cmd)
File "/usr/local/lib/python3.7/site-packages/ppadb/command/transport/__init__.py", line 23, in shell
conn.send(cmd)
File "/usr/local/lib/python3.7/site-packages/ppadb/connection.py", line 77, in send
return self._check_status()
File "/usr/local/lib/python3.7/site-packages/ppadb/connection.py", line 83, in _check_status
raise RuntimeError("ERROR: {} {}".format(repr(recv), error))
RuntimeError: ERROR: 'FAIL' 0006closed
While my two fire tv sticks are regularly online and working as expected…
Any hints?
Hello!
After getting back to HA after a longer break I configured my Sony Android TV using this integration. My configuration is simple, like this:
- platform: androidtv
name: Sony TV
host: X.X.X.X
adb_server_ip: 127.0.0.1
adb_server_port: 5037
get_sources: true
apps:
com.sony.dtv.tvx: "TV"
com.google.android.leanbacklauncher: "Home"
turn_on_command: "input keyevent 3"
turn_off_command: "input keyevent 223"
It works, there are few issues though. First is that I don’t see any sources but
STREAM_NOTIFICATION:
Strange
Another thing is that when I play Spotify on the TV I do not get “artist - title” of currently played song, I don’t know if it’s by design or it’s a bug. Also in the preview I don’t see cover art also but sort of like a small screenshot of current view seen on the TV.
Last thing is that the Media Player card flickers every few seconds, I don’t know if it’s because refreshing data on the cover and it’s to be expected.
I am also having issues with unavailable state after longer period but I did find some posts about wakelocks and sideloading an app to prevent this from happening and I will investigate further.
Anyway, all help is welcome, thanks!
Hello,
I am having an issue with the exclude_unnamed_apps
parameter. I thought this would display the apps defined in both the backend library and the ones I have defined in the apps
parameter.
Here is my config:
- platform: androidtv
host: 192.168.0.14
name: Nvidia Shield
adb_server_ip: 127.0.0.1
adb_server_port: 5037
exclude_unnamed_apps: True
apps:
"tv.molotov.app" : "Molotov"
"com.synology.dsphoto" : "DS Photo"
"com.synology.dsvideo" : "DS Video"
"com.google.android.music" : "Google Music"
"com.google.android.tvlauncher" : "Accueil"
"com.mobisystems.fileman" : "File commander"
"com.joaomgcd.join" : "Join"
"net.dinglisch.android.taskerm" : "Tasker"
"com.google.android.katniss.search.SearchActivityService" : "Google Assistant"
"com.google.android.apps.mediashell" : "Chromecast"
"com.android.tv.settings" : "Paramètres"
And here is a screenshot of the sources proposed by my androidTV media player
As one can see, I does not show some of the apps from the backend library (Youtube, VLC for instance). Some of my user-defined apps (DS video, DS photos from Synology) are not present in the list, until I open them manually.
Other problem, the “Home” source (accueil in the screenshot) does not work. It has also been reported by another user here.
Any idea ?
Thanks !
The sources list only displays the running apps, so it is behaving as intended. This could be documented better on the Android TV documentation page… The problem is that the page has become a bit cluttered, due to both the plethora of configuration options as well as all the ADB troubleshooting info. And with the decision to move towards config flows and away from YAML configuration, the configuration will stay the way it is until someone adds config flow support. And that’s not something I want to do!
You can always launch an app using the media_player.select_source
service call and putting, for example, source: YouTube
or source: "DS Photo"
, regardless of whether that source is currently in the drop-down sources list.
The command used by the backend library to launch apps doesn’t work for every app, as you found with “Accueil.” In those cases, you need to figure out the right intent to use with the androidtv.adb_command
service; this gist contains a lot of info about that.
Thank you for your complete answer
Hey all!
I am working on revamping my lovelace UI to mimic an actual touch panel, and I have successfully created a ‘Netflix button’ that will open the Netflix App on my Fire Stick 4K.
I want to add a ‘HULU button’ as well, so I added the same code except I changed the app id to ‘com.hulu.livingroomplus’ and no dice! I also saw that there is another app id for HULU, ‘com.hulu.plus’, I tried this as well and it doesn’t work either.
I am unsure what I am missing here - below is my config entry, and my lovelaceui entry. For clarity - my lovelaceui is done by using picture-elements with images & tap-actions.
Any thoughts and or ideas??
Copy to clipboard
- platform: androidtv
name: "Fire TV"
device_class: firetv
host: 10.20.18.14
port: 5555
adb_server_ip: 127.0.0.1
adb_server_port: 5037
apps:
com.netflix.ninja: "Netflix"
com.hulu.livingroomplus: "HULU"
com.amazon.avod: "Amazon Video"
Copy to clipboard
#HULU Button
- entity: media_player.fire_tv
image: /local/hulu_logo.png
style:
left: 20%
top: 60%
width: 20%
tap_action:
action: call-service
service: androidtv.adb_command
service_data:
command: am start -a android.intent.action.VIEW -d -n com.hulu.livingroomplus/.MainActivity
entity_id: media_player.fire_tv
type: image
I am not sure what I did - but i was able to get this to work, so please disregard.
Hi,
I am trying to make media_player
entity by standard androidtv
integration
media_player:
- platform: androidtv
name: Samsung Tablet
host: 192.168.1.71
But I am unable to get media_player.samsung_tablet
entity.
Any hints?
What do you have in your logs ?
[13:57:47] INFO: Starting the Android Debug Bridge server...
[13:57:48] INFO: Connecting to device: 192.168.1.71...
unable to connect to 192.168.1.71:5555: Connection refused
And why on port 5555? In configuration I do have:
What did you put in you config.yaml for the android tv platform ?
media_player:
- platform: androidtv
name: Tablet A
host: 192.168.1.71
adb_server_ip: 127.0.0.1
adb_server_port: 5037
- platform: androidtv
name: Tablet B
host: 192.168.1.72
adb_server_ip: 127.0.0.1
adb_server_port: 5037
(of course both devices do have Connection refused
error)
USB debugging activated and key confirmed?
Activated on both. Also ports opened on routers (most probably completely unnecessarily).
But… what key?
You have to accept the connection between your hassio instance and your android device.
Please try :
- revoke all debug authorizations on your android device (developer mode)
- restart your android devices
- restart HASSIO
- when hassio is restarted, you should have a confirmation on your android devices to accept the connection.
Done. No confirmation on Android.
But still, isn’t it important that:
- it is trying to connect on port 5555 and
- what is most mystic to me, that I have no entity
media_player.tablet_a
?
And in the addon config ? Can you show us ?