Skip to content

Add timeout parameter for LMS operations to Squeezebox#165324

Draft
peteS-UK wants to merge 2 commits intohome-assistant:devfrom
peteS-UK:add_timeout_option
Draft

Add timeout parameter for LMS operations to Squeezebox#165324
peteS-UK wants to merge 2 commits intohome-assistant:devfrom
peteS-UK:add_timeout_option

Conversation

@peteS-UK
Copy link
Contributor

Proposed change

Currently, the Squeezebox integration uses a default 5 second timeout for LMS API operations. This PR add a config option flow item to allow this to be configured.

WIP as it requires an underlying library fix, tests and doc update.

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)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • 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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings March 11, 2026 11:24
@peteS-UK peteS-UK marked this pull request as draft March 11, 2026 11:24
@home-assistant
Copy link

Hey there @rajlaud, @pssc, mind taking a look at this pull request as it has been labeled with an integration (squeezebox) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of squeezebox can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign squeezebox Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a configurable LMS request timeout option for the Squeezebox integration and wires it into multiple player control calls to better handle slow LMS/network environments.

Changes:

  • Introduces a new options-flow setting lms_timeout (default 5s) for LMS request timeouts.
  • Passes the configured timeout into multiple pysqueezebox player command calls via safe_library_call.
  • Updates integration translations/options UI strings related to the new timeout setting.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
homeassistant/components/squeezebox/strings.json Adds options-flow label/description for lms_timeout and introduces a new exception string.
homeassistant/components/squeezebox/media_player.py Reads lms_timeout from config entry options and supplies it to many player commands; adds extra safety wrapping for some calls.
homeassistant/components/squeezebox/const.py Defines CONF_LMS_TIMEOUT and DEFAULT_LMS_TIMEOUT.
homeassistant/components/squeezebox/config_flow.py Adds lms_timeout to the options schema and suggests current/default values in the options form.

Comment on lines 593 to 598
await safe_library_call(
self._player.async_load_url,
media_id,
cmd,
self._get_options_lms_timeout(),
translation_key="load_url_failed",
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The new lms_timeout option is applied to async_load_url(...) here, but other LMS calls in the same code path (e.g., async_load_playlist(...) and the custom async_query calls used by the services) still use the library default timeout. Consider applying the same configured timeout consistently to all LMS requests to match the option’s description.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants