8000 Add installed apps to samsungtv sources by epenet · Pull Request #66752 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add installed apps to samsungtv sources #66752

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

Merged
merged 8 commits into from
Feb 18, 2022

Conversation

epenet
Copy link
Contributor
@epenet epenet commented Feb 17, 2022

Proposed change

Add installed apps to samsungtv sources

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @escoand, @chemelli74, mind taking a look at this pull request as it has been labeled with an integration (samsungtv) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@bdraco
Copy link
Member
bdraco commented Feb 17, 2022

Ideally this gets converted to asyncio sometime in the future. If the TV is off its tying up an executor thread for a while while it has to timeout to determine the TV is offline every update cycle.

@epenet
Copy link
Contributor Author
epenet commented Feb 17, 2022

Ideally this gets converted to asyncio sometime in the future. If the TV is off its tying up an executor thread for a while while it has to timeout to determine the TV is offline every update cycle.

I'll look into that. Is that something that I could do in HA? or would it need a change in the underlying library?

epenet marked this pull request as ready for review February 17, 2022 17:24
@epenet epenet requested a review from chemelli74 as a code owner February 17, 2022 17:24
@bdraco
Copy link
Member
bdraco commented Feb 17, 2022

The underlying library needs to be replaced with an async solution

"""Send the key using websocket protocol."""
if key == "KEY_POWEROFF":
key = "KEY_POWER"
if remote := self._get_remote():
remote.send_key(key)
if key_type == "run_app":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn mor 8000 e.

Why do we overload the _send_key method to run apps ? The media player knows it's running an app and could maybe call run_app directly ?

Copy link
Contributor Author
@epenet epenet Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is because the primary send_key method in the bridge has a retry mechanism that I didn't want to bypass.
I pland to rename the method to make it more obvious (send_key to send_command) in a follow-up PR.

retry_count = 1
for _ in range(retry_count + 1):
try:
self._send_key(key)
break

@epenet
Copy link
Contributor Author
epenet commented Feb 17, 2022

Rebased to fix conflict

@balloob balloob merged commit 3aa18ea into home-assistant:dev Feb 18, 2022
def send_key(self, key: str) -> None:
if self._attr_state == STATE_ON and self._app_list is None:
self._app_list = {} # Ensure that we don't update it twice in parallel
self.hass.async_add_job(self._update_app_list)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not allowed to use the async api from sync context. Probably use hass.add_job if we want to schedule this call. Otherwise we can just call it directly.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2022
@epenet epenet deleted the samsung_app_list branch February 20, 2022 13:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0