-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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 not working with Android TV integration #56567
Comments
androidtv documentation |
Hey there @JeffLIrion, mind taking a look at this issue as it has been labeled with an integration ( |
Any update on this issue? |
This comment was marked as abuse.
This comment was marked as abuse.
Any update here? |
Same here. (Re: Just seeking an update) I'm happy to lend a hand - it sounds like the source of the issue is identified (?). What's left to be done? I can take a look / potentially address; just hoping to avoid sifting through comments and code, since the current details are rather sparse.. Much appreciated. Cheers |
As far as I can tell there's a fix in the works - JeffLIrion/python-androidtv#271 has more info |
Hope this can be fixed, did an update from google break it?
…On Tue, 30 Nov 2021 at 11:18, Peter ***@***.***> wrote:
As far as I can tell there's a fix in the works -
JeffLIrion/python-androidtv#271
<JeffLIrion/python-androidtv#271> has more info
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#56567 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APD5BYDRADSIJZYI7J5MZATUOSXJNANCNFSM5ETM54NA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Kind Regards,
Seth Kazzim
CEO
Erebor
Website: erebor.co
<http://apps.apple.com/gb/app/erebor/id1476194291>
<https://play.google.com/store/apps/details?id=co.erebor.app>
Mobile: +447432457398
LinkedIn: Personal <https://www.linkedin.com/in/sethkazzim> & Erebor
<https://www.linkedin.com/company/erebor-ltd/>
Registered Address:
Kemp House,
160 City Road,
London,
United Kingdom,
EC1V 2NX
Erebor Ltd is a company registered in England and Wales with company
number: 11964616
D-U-N-S Number: 225028911
|
Android 11 uses random ADB port each time. Below is a section of python script that connects to an Android 11 client over adb. It uses a port scanner to try connecting (the code is not that clean, but maybe it can help someone here solve the issue in HA). Might be a problem for HA as the scan is slow depending on the number of threads you use. If you specify a lot of threads then you eat up ram. My code could certainly be optimized better. |
FYI ShieldTV is rolling out Android 11 updates today, going to impact a lot more people soon. |
I just updated. The port remains as 5555. Props to Nvidia for reverting this! |
After updating my Nvidia Shield to Android TV 11 the integration regarding playstate fails. However the integration can interact with adb on Nvidia Shield with Android TV 11. |
Hopefully there will be a fix soon, I was already aware of this issue though so lucky haven't let my shield update. |
just updated my shield tv, wasn't aware of this issue before... was able to use this fix: |
Can confirm that this works. :-) |
How do we update the file on Home Assistant? I use Home Assistant OS |
You have to SSH into underlying OS, and replace it from there. It's a little hairy if you're not comfortable with command line. https://developers.home-assistant.io/docs/operating-system/debugging/ |
@undulattice Before I update to 11 and apply this fix can you confirm that it's pulling all app status information through as it did on the previous build, specifically the media duration and position for apps such as plex, etc? |
I always found the AndroidTV implementation of duration, position, etc. a bit flakey. Always used the cast integration for it, which continues to work perfectly. |
Yeah, I do use the cast one and the separate plex one but just wanted to confirm everything is as it was on the previous version before upgrading as I have an esphome AVR display that has a progress bar on it I didn't want to lose that functionality. |
This is a hack and not a supported method. We strongly discourage such practices and I would appreciate it if this was not advised or discussed in official resources/channels. Keep in mind, not everyone knows what they are doing there. The correct way to handle this is to fix the actual integration or run it as a custom integration (which can be modified at will). |
@frenck |
As I am not able to contribute to a proper solution in HA, I created this custom_component as temporary solution |
Thanks @deviant-aut. Works great so far. :-) |
I copied this custom component in, but I'm not seeing it do anything. Should it just work with my existing yaml configuration for my nvidia shields, or do I need to reconfigure them through discovery to make this work? Thanks! |
If you put all files into the correct folder it should just work with yoir existing configuration. |
@rdgerken Leave everything as it is. Rename the custom component directory to androidtv, and restart HA. |
Does anybody know if the fix is coming soon to the official AndroidTV integration? It's been a while... |
We're all cheering you on! :) Could someone explain what we'd need to learn to help with such issues in the future? |
Cross-posting here for visibility (JeffLIrion/python-androidtv#271 (comment))
|
Do we know if @JeffLIrion 's code has been pulled into the 2022.2 release? |
I believe @JeffLIrion's update was just to allow specific commands per device. I don't believe anyone has actually written the code to choose the right commands for all the devices that need to be supported yet. |
This issue has been a known issue for over 4 months now, and while reading this conversation, the fix is already provided by few individuals as a workaround. But still the main repository, used by HA is not updated nor fixed. What's taking so long time with getting this fixed? I understand and appreciate the fact that people are doing these things for free, but in case the owners, who can fix this, do not have the time/interest, maybe someone else should be promoted as individual having rights to update the repo? |
The key word is workaround. A pull request with proper unit test coverage that does not break compatibility for pre-Android 11 devices has not been submitted. And anything short of that is not a fix.
There's no need to "promote" someone to be able to update the repo. Literally anyone can submit a pull request. |
Thanks for the reply! Any reason why meanwhile two separate versions, one for pre 11 and one for 11 could not be created? I admit, I am no expert on this area which why the question might be really stupid from technical point of view.. The workaround by using custom component setup is not reliable (works for a while, then status going to idle and staying as such) , and the other listed workarounds are neither an option for me (as the folder where the updated file should be copied to does not exist). And the lack of HA not being able to identify if shield is playing, idle, paused etc.. does make all linked automations useless. I'm thinking of reverting back to 9 with my shield, but if we will have this fixed in next few week's, I'll rather wait. But right now the fact of one of the core integrations not working as should, and unawareness of ETA is leading to people being unaware of what' s going on, if anything + not knowing if they should wait for week/month/half year/year. |
Hi folks, could this be part of the reason why after the 2022.2.2 upgrade I cannot switch apps on my Nvidia Shield running Experience 9? I was able to launch apps in 2022.12.10. I don't want to log an issue if this is all related to the Android TV 11 advisory which the Shield is currently running. |
What do you mean "switch apps"? What exactly are you trying to do? |
Hi there. Switch apps is probably not the right term - I meant the
launching of apps. For instance, I have a script that starts Spotify which
no longer works. When one attempts to “select source” on the media player
component, the relevant app does not launch.
…On Sun, 06 Feb 2022 at 20:12, manticore1991 ***@***.***> wrote:
Hi folks, could this be part of the reason why after the 2022.2.2 upgrade
I cannot switch apps on my Nvidia Shield running Experience 9? I was able
to launch apps in 2022.12.10. I don't want to log an issue if this is all
related to the Android TV 11 advisory which the Shield is currently running.
What do you mean "switch apps"? What exactly are you trying to do?
—
Reply to this email directly, view it on GitHub
<#56567 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJBDEVLONPW6OYNNLQUICWLUZ22XJANCNFSM5ETM54NA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
Ahhh, I see! Could very well be another problem related to Android TV 11. |
Would be nice if we could at least take the approach of having 2 versions while a proper fix (read: not workaround) is implemented? I upgraded to Android 11 on the Shield strictly by accident; wasn't aware of this issue and unable to roll back. Everything else has been working great on it, minus this integration. |
Fully agree, there's no insight of when a full blown solution (compatible with pre-11 and 11) would be avail. Thus a workaround with two versions would be a decent solution. |
There are basically two issues that prevent this integration from being properly fixed on Android 11+ devices connected over Wi-Fi.
In short: For Wi-Fi connected Android devices there seems to be no solution without port scanning, which is frowned upon from a security perspective, and it would only work if the ip address is known/static, which is only the case when the user disabled MAC randomization for the active Wi-Fi network. The only reliable fix: Use a wired network |
This pull request would allow users to fix it for themselves by customizing the ADB commands used: #65397 You'd just need to figure out the right ADB commands. Regarding the "2 versions" suggestion, again, anyone can step up and work on this... |
This is atypical, and substantially more effort, but could a solution be to introduce a client-side app to track and report back IP address and ADB port changes? |
Note: If device is wired, the port remains 5555 (at least on Shield). Also, yea my port scanning method is not the greatest, kind of slow too. Works for my use case, but I already know the ip address. If ip address is unknown, it's a terrible method. |
An Android app can keep track of the IP address, but the user can disable MAC randomization for a given Wi-Fi network and then the IP address won't change anyway, so that's not the main issue. An Android app can check if ADB over USB is enabled by reading this value, https://developer.android.com/reference/android/provider/Settings.Global#ADB_ENABLED: It is not documented, but this can also be done for wireless debugging: However, then we'd only know whether ADB over Wi-Fi is enabled or not. I don't think there is a readily available programmatical method to determine which port is active. That information is not available in the device properties or the global/system/secure settings and I don't think Google made it available through documented Android APIs. Sooooo, as far as I know there is currently no workaorund other than port scanning to find the ADB port when the Android device is connected via Wi-Fi. The easiest solution is still to connect the Android device via a wired network :) |
So all you have to do is select which command set to use via a drop down during setup? A dropdown with "AndroidTV 10 or earlier" and "AndroidTV 11+" sounds like an easy solution. |
Couldn't a workaround be an app installed on Android TV, which takes care of the stuff we previously relied on adb for? Reporting state, launching apps etc. |
Having an app that provides the wanted information on the device could be a more optimal solution (instead of using something that's designed for other purposes) depending on what sort of access a regular app has on the device. This would not be a workaround but another approach to interact with android tv devices. However, this would require someone to develop and maintain the app. If some of you want to volunteer and work on that approach, it makes sense to first contact the developers of the official companion app to get their opinion if it could be extended to cover at least the common use cases. But all of this is somewhat offtopic for the issue at hand, and should be discussed elsewhere. (this is just my 0.05e as onlooker, I tried to create a simple media status tracker app on android at some point and found quickly out that tracking the media state isn't as simple as I thought as not all apps were using the mediasession apis back then) |
Something like unified remote, which doesnt have an android server yet; https://www.unifiedremote.com/download/other |
Not sure if this is the right spot to post this, so please forgive me if not. I went through with ANDROIDTV.LEARN_SENDEVENT |
I'm connected to a wired network, and the integration still doesn't work. I can turn it on and off. I can see a preview of what is playing, but status is always idle. I'm guessing there is more to it that wired vs WiFi. |
This is not the case with Android 11 and is only potentially an issue with some Android 12 devices. https://source.android.com/devices/tech/connect/wifi-mac-randomization-behavior#persistent It seems like the other issue has to do with port scanning for the adb port on wireless (I would presume such a solution would likely not be accepted into HA core). The workaround for this in core would probably have to require using a wired connection or maybe the official companion app could provide home assistant with the adb port (it appears that the port is stored in the property I'm trying to figure out the state of affairs with this issue. I currently see there is a pull request at #65397 which appears to fix some issues with the commands being incorrect. Additionally, I see there is this custom component that was created several months back, which I presume also has fixed some issues? Does anyone here have any concrete understanding of what is broken/what needs to be fixed/what has already been fixed? |
@alexyao2015 The custom component based on barmazu's fork pretty much 100% fixes the issues with Android 11 on the Nvidia Shield. What's requied I believe are these alterations to be transposed into the device-specific commands - more details here |
The problem
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.
Currently implemented adb commands in the integration cannot parse states or running apps due to changes in reporting from Android TV 11.
What is version of Home Assistant Core has the issue?
2021.9.7
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
androidtv
Link to integration documentation on our website
https://www.home-assistant.io/integrations/androidtv/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Issue in integration github: JeffLIrion/python-androidtv#271
Community forum discussion: https://community.home-assistant.io/t/new-chromecast-w-android-tv-integration-only-showing-as-off-or-idle/234424/43
The text was updated successfully, but these errors were encountered: