-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android TV 11 showing only Off, Idle or Standby, not recognizing running apps #271
Comments
To be honest, I have very little time to work on this package, and so it's mostly up to the community to contribute features and fixes. This is something that needs to be done to unblock further development: #255 With that in place, it would be easier to tailor commands as needed for different devices. |
In its current state integration does not work with Android 11 and will not be implemented soon JeffLIrion/python-androidtv#271 (comment)
In its current state integration does not work with Android 11 and will not be implemented soon JeffLIrion/python-androidtv#271 (comment)
I just updated my Sony Bravia TV to Android 10 and there is the same issue - the integration stopped working correctly. |
Yes, me too. Wasn't expecting that Android 10 will not be compatible because only Android 11 had been mentioned in the issues / Home Assistant alert. |
Hi @blakadder and others, I have started working on Android 11 (maybe 10 as well) support; for starters very basic support is introduced here https://github.com/barmazu/python-androidtv/commit/c7b0a403cd3745f1e671ad63ad005da13f494d5e just by swapping commands that are send to ADB shell.
|
So I've updated constants.py file, it should work on both domains, ie Android 9 and 11, see here: https://github.com/JeffLIrion/python-androidtv/compare/master...barmazu:a11_support?expand=1
I'll push PR here once I update the Unit Tests (HDMI Sony TV seems like a major break point now) |
@barmazu my comments in this post still stand true: #271 (comment) The IMO, that is the right approach to resolving this issue, whereas modifying the existing commands is merely a band-aid fix that could introduce new issues. I really don't have time to work on this myself, so I need someone to take on this effort of
|
Hi @JeffLIrion! Agreed, I'm willing to do it but this is not a one day task, and honestly I didn't have much time either (to work around A11 support). With current implementation its awful, does not scale up at all, you don't have to say anything, this is obvious it would be very hard to maintain it; with still growing Android TV base it will be impossible to keep up. Dirty patch I made is just unblocks me, maybe some other will take advantage and by any means does not replace necessary code refactoring. This is also my first meet with ATV from this side of things so I'm just looking around. Mostly. |
Hey, I will take a look to this on next days, may be next w.e., to see if I can help to split |
I would like to test this on my android TV 10. I just don't know how to get it into my HA. Can anyone advise step by step installation? |
Replace the file /usr/local/lib/python3.9/site-packages/androidtv/constants.py with this one. Beware, the mentioned file is inside the homeassistant docker container though. I haven't tried it, but it seems that the android11 update for the nvidia shield is right around the corner. |
Can confirm fork from @barmazu is working on Nvidia Shield TV 2017 with Android 11 It shows active app and state
|
Do you know where i have to put the file in HassOS? The path u send doesnt exist :( |
run "docker exec -it homeassistant bash" to launch terminal in container. There you will find the path. |
I figured out I needed to use "docker cp" command from outside the container to copy the new file over from the OS to within the docker. I use HA Core. |
This is 90% reliable for me with my Nvidia shield on Android 11. The only issue I'm encountering (for my needs) is that every so often the media player state will randomly change to standby resulting in my lighting increasing in brightness. |
@tungmeister |
next time it happens I'll try and get the details. |
Looks good, but how this is different when you see "playing" state? How often state shifts from "playing" to "standby"? |
it lasts for about 10 seconds or so. The problem as as soon as I "GET_PROPERTIES" that returns the right wait lock and session state so the lights dim again. It's happened maybe 8 times this evening. (4-5 hours of playback) |
OK, that quite often I'd say.
It will evaluate the very last audio player state entry (as seen by logs) which should be most recent app playing audio... Thanks! |
Sorry to bother you guys but, could somebody explain me how to be able to see folder Pyhton inside lib ? |
Not sure if same for you, but I didn't have a "local" folder with the Core Docker install. I had to skip that directory. |
the response from the same command when it's 'behaving' :
|
Thanks! Much appreciated your time. |
Another issue in plex, drop-down menus are being interpreted as a playing state:
|
@tungmeister Please update line as below and check: EDIT: |
@barmazu i'll update. for the popup:
|
Not sure if it's been reported before but setting volume does not work on the shield, although getting volume value is working fine. |
You mean the volume slider? If so - yup, it does not work - underlying ADB shell command (media volume) has been removed from Android 10+. So this need to be re-implemented in module code. Otherwise +/- volume buttons should work fine. |
Yeah volume slider sorry should have been more specific. I ll temporarily replace the slider by buttons in my interface then. Thanks for your continuous help |
@barmazu I ran your custom code and it does not work with OS 10 (on Walmart's Onn Android TV box). Not working = not reporting running app, stuck in idle state. Based on reading this thread, I think this info will help... let me know if you need more info GET_PROPERTIES:
dumpsys window windows:
|
I did a lot of work to spport device-specific commands. Now all that's needed is for someone to submit a pull request. python-androidtv/androidtv/basetv/basetv.py Lines 94 to 173 in 1577e22
|
would love to do it but i have no clue how it is integrated in the code exactly. |
What needs to be done in the PR, and from / to which branch? |
Hey @JeffLIrion, you probably to release the androidtv package under v0.0.61, and someone will update to the latest verision in
|
@ejalal bumping the version wouldn't make a difference. Android 11 is still not supported because there hasn't been a pull request to add this support. On a related note, I've marked this repo as "contributions only." As explained in the README:
|
@JeffLIrion how can i send a request to support android 11 and android 10 which also doesn't work. |
Looks like that doesn't work with 2022.2 unfortunately, the integration fails to load because of a missing Device Enum in the file. |
@Ulrar You can use the custom component created by deviant-aut and replace the file there (if needed). |
Yep, I was hoping to avoid it since that's one thing to remember to delete whenever that bug gets fixed but it does work, I'll go with that. |
Does this need to go to develop? Once this is in, do we need to add device specific commands for AndroidTV 11? |
This should be resolved by #310. |
FYI: |
Another FYI: I had to remove the integration and add it again for the state changes to work. (Shield 2019 Pro). I have another shield that I need to test. |
I found this not to work without continuing to use the custom component with the modified constants.py file. Even after deleting and readding the integration, all I accomplished was wasting time. |
Seems I was too early to declare it solved for me. States are taking a long time to update and are not always accurate. For example, I played a video, state changed correctly. Then it switched briefly to standby, and then back to playing although nothing is playing. In order to get direct updates, I'm updating the sensor via node red every 2 seconds, but that doesn't help. Furthermore, the entity state shows "InputMethod}:" beneath the state instead of the app that is in use and it stays the same, no matter what app is active. I haven't used any custom integration and waited until the official integration was fixed and then I upgraded to android 11. This is on a nividia shield 2019 pro that is connected via Ethernet cable with a fixed ip. Changing apps via the drow down menu seems to be working fine and instant. Logfile doesn't show anything related to this. If you need any further information from me, just let me know. |
That's right, same behavior here. That said the chromecast integration is a good workaround for these bugs for now |
Thanks for the hint with the chromecast integration, but that only works half of the time it seems. playing/paused seems to working well with Kodi, but not with netflix. State is playing with netflix just being opened and there are not state changes between playing and paused on netflix. I just use this integration for two automations:
So both these automations are not working anymore. While it is inconvenient, it is not a huge issue for me. The only thing I'm not too happy with is the communication with regards to this bug. Either it is completely fixed, then this issue should've been closed or it is not fixed and the warning should've stayed up. This way, it gives people the wrong impression, even announcing it for the latest release. Hopefully this can be avoided in the future :) |
I was able to reproduce the issue with showing "InputMethod}:". I see it randomly when changing apps. But it will change to the correct state after about 2 seconds. App detection works fine. Example for Netflix which works for me (and most of my apps)
Everything else seems to be ok. I am running Android 11 on Nvidia Shield 2017 (experience 9.0.2). |
Just another FYI for anybody with the same problem: I had to install to custom_component androidtv integration for it to work again. Just the official fix alone didn't fix it. https://github.com/deviant-aut/HA-androidtv11 EDIT: Seems I was too quick once again. Sometimes it works, most of the time it doesn't though. Paused sometimes is detected as standby, most of the time it is not detected at all. But since I also have problems with the shield itself (audio not working after standby without a reboot) I might just roll back to version 8. |
FWIW... On android 10.... I don't believe the current logic in For now, I've installed the androidtv11hack and modified CMD_CURRENT_APP = "dumpsys activity a . | awk '$1 ~ /mResumedActivity/ { print $4 }' | cut -d'/' -f1" In my case—at least with Netflix—only 2
Some backgroundOnly added this for future reference and to potentially give some insights. HTH.
Before the fix..YT
Netflix
After the "fix"YT
Netflix
Pretty printed w/ |
Hi all, If this integration will no longer be supported, this should be considered in the HA CORE in my opinion, because in the future, I think more and more devices will be available with unsupported versions... :-( Unfortunately, my experience with ADB and python development is probably not good enought to contribute to this integration... :-( :-( |
I have a TCL TV with Android TV 11 installed running on latest release HA (2021.9.7) and I the only states HA receives are Off,Idle and Standby with adb response: null in Developer - States tab.
I ran the commands through adb shell and these are the results:
gives no response
this works
Here's full output of dumpsys window and dumpsys activity starter in a gist link
The text was updated successfully, but these errors were encountered: