-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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
Conversation
Hey there @escoand, @chemelli74, mind taking a look at this pull request as it has been labeled with an integration ( |
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? |
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": |
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 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 ?
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.
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.
core/homeassistant/components/samsungtv/bridge.py
Lines 141 to 145 in d6100ab
retry_count = 1 | |
for _ in range(retry_count + 1): | |
try: | |
self._send_key(key) | |
break |
878fb66
to
fa0fa71
Compare
fa0fa71
to
04115ee
Compare
Rebased to fix conflict |
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) |
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.
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.
Proposed change
Add installed apps to samsungtv sources
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: