-
Notifications
You must be signed in to change notification settings - Fork 62
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
Enable use of different ADB commands depending on the device properties #272
Conversation
Hi, thank you for investing time in this. I tested it on a fire tv cube and it seems to work. It can detect the playing state for netflix but it seems not to work with amazon prime for me. Should this work at the moment? |
I think that fireTV need some tuning with last software release. This is the reason for having the |
Thanks for taking the initiative on this. Let me start by saying that I have very little time these days to work on this project. As such, (1) small & simple pull requests are much easier to get merged in and (2) I rely heavily on the unit tests, test coverage, and linting checks that CI performs. General comments about this pull request:
|
Got your point. Not so simple to keep this PR small, because is impacting the logic that the library is implemented. Also not so simple for me to find the time to work on this, for sure only w.e are available. |
Formatting the code using black as a separate pull request would help to minimize the diff. I created a pull request that does that: #272. I can merge that, if you'd like. Also, refactoring the Then this task simply amounts to tailoring the ADB shell commands used by the various "Properties" methods (example). As I see it, that is the cleanest path forward. |
I think that have code black formatted would help a lot. So yes please, merge that PR.
I do not understand if you are working on this or just suggesting how to. I just would avoid to make same changes that you are working on. |
I'm not working on it. |
Hi @ollo69, et al. Thanks & Merry X-mas |
|
In the time since this pull request was opened, I have:
The bad news is that this pull request is very outdated. The good news is that these changes could be made much more easily and/or support for Android 11 (or any OS) can be achieved by enabling users to specify ADB shell commands themselves via the python-androidtv/androidtv/basetv/basetv.py Lines 102 to 117 in 26a4d74
I don't know much of anything about config flow in HA, but I think you could add options for configuring these commands: python-androidtv/androidtv/constants.py Lines 37 to 51 in 26a4d74
|
Sorry guys, I was busy from when I open this PR and happy to see that @JeffLIrion find time to work on this theme.
I think that we can add an option flow to manage this in config flow, something very similar to the wizard used used to create app list. Just not totally sure that HA teams like this approach. I will analyze this method and try to work HA side. I think this PR does not make anymore sense, can we close this? |
Yeah, I'll close it.
Why do you think they wouldn't like this approach? Of course, it's not as nice as if this package could use the right commands for every device and OS under the sun. But that's just not possible. By all means, contributions are welcome and it would be nice to have those device-specific State detection is the same way: it's not possible to work for every app on every device, so this package provides a way for users to configure their own state detection logic. Without the ability to customize ADB commands, users could be stuck with a broken integration for a month or longer until it gets fixed here and a new HA release gets published. |
Maybe they can consider not correct allow user to define command, but maybe not, I agree with you that detection rule is the same approach, and they are there in option flow. I'll implement this in config flow, we will see feedback in review... |
This PR is related to issue #271.
I changed the
_fill_in_commands
method that now is generic inBaseTV
. Method now works in this way:device_class
provided during initialization or detected by device properties, replace default commands with specific command defined in a new file calleddevices_definition.json
. This new file can be used for:auto
The file is configured to support
firetv
,chromecast
(old android version) andandroid11
devices based on information get in related issue #271, but I could only test it onfiretv
because I don't have other android devices.There are a lot of file changed, but main changes are in
basetv.py
. All other changes are just little adjustment to use the command loaded during the call to_fill_in_commands
and to add the parameterdevice_class
on initilization.