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
Add 'adb_response' attribute to Android TV / Fire TV #23960
Conversation
It can be the case that this |
This ensures that the `'adb_response'` attribute contains the response to the latest command
@rytilahti are there any other changes you'd like me to make? |
return self._adb_response | ||
|
||
response = self.aftv.adb_shell(cmd) | ||
if isinstance(response, str) and response.strip(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit hacky.. Is there some case where the adb_shell() call would be returning something else than a string? If not, it'd be just easier to check for that here? Otherwise I think this would be better handled in the backend lib.
Other than that it looks fine to me; I don't have a device at hand, so I cannot really do any testing on functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's either a string or None
. I've been using this version of the component, it works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd personally prefer then checking against Noneness here, but it's fine as it is. Let's merge this, thanks! 🎉
…23960) * Add 'adb_response' attribute to Android TV / Fire TV * Use None instead of empty string for empty ADB responses * Initialize self._adb_response as None, not empty string * Update the state after sending an ADB command This ensures that the `'adb_response'` attribute contains the response to the latest command
Description:
This stores the output, if any, of the
androidtv.adb_command
service in a state attribute --'adb_response'
-- so that it can be used in automations / scripts.Checklist:
tox
. Your PR cannot be merged unless tests pass