Sure, thanks for your list, it’s really helpful
So I have the addon setup and the FireTV added into HA. When I change apps and stuff it detects the app just fine. However, the play state doesn’t appear to get updated reliably. It feels like when I start playing a video, it detects that it started playing about 10% of the time. Even after waiting a minute for it to change. But most of the time, HA just doesn’t see a video playing.
Is there something that I’m missing here?
Edit: After some more testing, it seems that it perfectly detects when I play it pause a video in the Plex app, but it does not do so in Amazon Video. Does anyone know why that might be the case?
I have the same issue with the Fire TV Stick 4K and needed a code change specifically for Amazon Prime Video.
I’ve done a PR a while back but got no idea when it’ll be pushed to HA.
In the meantime get the Android TV from HACS then edit firetv.py and replace lines
# Amazon Video
elif current_app == constants.APP_AMAZON_VIDEO:
if wake_lock_size == 5:
state = constants.STATE_PLAYING
else:
# wake_lock_size == 2
state = constants.STATE_PAUSED
with
# Amazon Video
elif current_app == constants.APP_AMAZON_VIDEO:
if media_session_state == 2:
state = constants.STATE_PAUSED
elif media_session_state == 3:
state = constants.STATE_PLAYING
else:
state = constants.STATE_IDLE
As this will work, it’s not a really good way to change that behaviour. With the next update your changes are gone, and you have to do it again.
But there is another possibility to solve this, update safe and easy:
After checking the intents (tutorial is linked in the docu) you can set them up especially for your installation under the media_player
component, like so:
- platform: androidtv
name: MagentaTV Stick
host: !secret host_magentatv-stick
adb_server_ip: 127.0.0.1
adb_server_port: 5037
apps:
de.telekom.magentatv.androidtv: "MagentaTV"
[...]
exclude_unnamed_apps: true
state_detection_rules:
'de.telekom.magentatv.androidtv':
- 'playing':
'wake_lock_size': 3
- 'playing':
'wake_lock_size': 2
- 'paused':
'wake_lock_size': 1
- 'idle'
Those changes are included in this pull request: https://github.com/home-assistant/core/pull/35707
In the meantime, you should use the approach mentioned by @paddy0174. That custom component is experimental and you should use the built-in component.
That pull request also introduces a way to learn commands that work faster than sending commands like UP
, LEFT
, HOME
, etc. via the androidtv.adb_command
service. The pull request is just waiting to be merged…
This pull request is also waiting to be merged: https://github.com/home-assistant/core/pull/35710
Would this by any chance include commands to change inputs also? and keyevent 224 (wake screensaver). Thanks, awesome work… been working perfectly since the last time you made a fix for an OS error I kept getting.
I think it will work for commands that you send via a remote; I think I tried once with a command I sent via ADB and it didn’t work. It’s meant to be used for commands that you want to run quickly, like navigation keys.
You can test it out by following the instructions in this post: https://github.com/JeffLIrion/python-androidtv/issues/139#issuecomment-628652593
Thanks I’ll check it out
I’ve been searching for a couple of days now and I’m hoping someone here might have the answer. Does anyone know how to launch the Live Channels app and set the channel? I see how to launch it and then i can send a input text of the channel and that would work but I’m looking for a way to launch into the right channel in one step instead of two.
I’m looking into this as well. The only solution I found was using the channelsDVR. But I would prefer if I could turn on the iptv smarters app on a selected channel. Have not found any solution for this yet
Is anyone having very long delays when using keyentries with adb bridge? I cannot find what is the source of the delay and how to reduce it. If a press the homebutton on the remote (lovelace) it takes around 5 seconds to trigger on my firetv.
I’ve been looking at possibly using Home Assistant in conjunction with the Live tab on a Firestick. Sort of a long story but part of a hopeful cord cutting if I can automate enough of it that my Mom is satisfied with the experience being somewhat similar to regular old cable. And I mean, our cable in this small burg is old school, not even a channel guide, just 70-ish channels being a mix of OTA and premium.
I did get Home Assistant running under Docker and was able to use some of the commands in this thread successfully - just sort of testing the water to see if I can even comprehend this enough to actually go any further with it.
What I have not been able to do is understand how to take that the next step and figure out how that translates to the combined sources in Fire’s live tab or even to a lesser degree in the Sling app. I haven’t gotten an OTA tuner for the network yet but I did get a subscription to Sling just to see what I could find out. Can someone point me to a resource that would help me?
For instance I read enough to understand that remote ADB shell might help. I installed it on a phone and connected it with the fire stick. I tried changing channels in the live tab and looking through the results but without understanding what exactly I’m looking at, it’s a needle in the haystack. For instance I changed to a Pluto channel (on the live tab not in the app) and I THINK I may have found part of the log that may be related to that channel change, but it may not. And even if it is, I don’t know what part of it is the important part needed for a command that will work. I made a few stabs in the dark before giving up! Is there some sort of primer to read that will explain what exactly I’m looking for?
I started to include a screenshot of the part that I thought was connected to my channel change but then I was afraid that since I don’t know what it is, it might have information that identifies my account or something?
Thanks!
Hi guys, I’m fairly new to HA and trying to install this add-on but cannot see it in the list. Am I looking at the right area?
I’m using HA in the docker on Intel.
Thank you very much,
Dmitry
Add-ons are only available on HA supervised (you might manually install them on docker but I can’t help you with that). If you have HA supervised you should see the Supervisor tab, where you could find the Add-on store.
I’m having the strangest issue that began out of nowhere. When I’m connected to the addon my shield shuts itself off every couple of minutes. If I disconnect it from adb it works flawlessly. But I can’t use my automations because I’m not longer connected to HA no idea what it could be
FYI
You can use the Android TV integration without the add-on.
It used to be the case that the Python ADB implementation didn’t work for newer devices due to the backend library that was used, but I created a new library and I don’t hear reports of it not working for people. So unless you’ve tried using the integration without the add-on and found that it didn’t work, you don’t need to use the add-on. (And if the Python ADB approach didn’t work for you, you can capture a debug log and open an issue in the adb_shell
repo.)
P.S. The Python ADB implementation surely uses less resources than running an ADB server, and it should also be faster than using an ADB server to communicate with the device (but the time scale is so small that you probably wouldn’t notice).
Nice, thanks for this. Was hunting around for the “add-on” but am running HA Core.
Entered the config for “python implementation” and done. Easy. Cheers.
Anyone else running into issues with the adb getting locked shortly after HA startup?
2020-11-17 21:49:57 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:50:02 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:50:11 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:50:21 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:50:31 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:50:41 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:50:51 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:51:01 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:51:11 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:51:21 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:51:31 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:51:41 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:51:51 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:52:01 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
2020-11-17 21:52:11 INFO (MainThread) [homeassistant.components.androidtv.media_player] ADB command not executed because the connection is currently in use
(occurs with both the python library and the adb server)
Hey guys I’m trying to connect my 2019 Nvidia Shield to HA just to turn it on or off (in order to turn or off my plex server). I managed to connect everything, however I can’t seem to configure my turn_on et off commands, they just won’t work. However they work when using the services
Here is my config:
- platform: androidtv
host: XXXXXXXXXXX
name: "Shield"
get_sources: false
device_class: androidtv
turn_on_command: "MENU"
turn_off_command: "SLEEP"
Anyone can help me here?
Thanks a bunch!
Disabling the screencap should fix that.