Create issue for Sonos when Sonos system does not have UPnP enabled#159330
Conversation
|
Hey there @jjlawren, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR addresses a bug in the Sonos integration where UPnP being disabled by default in recent firmware causes connection failures and unhandled task exceptions. The fix adds proper HTTP 403 error handling and creates repair issues to guide users in enabling UPnP on their Sonos system.
Key changes:
- Added HTTP 403 error detection and repair issue creation when UPnP is disabled
- Implemented comprehensive exception handling in speaker discovery tasks to prevent unhandled exceptions
- Added test coverage for both discovery and manual host configuration scenarios
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
homeassistant/components/sonos/__init__.py |
Adds _process_http_conection_error method to handle HTTP 403 errors and create repair issues; wraps discovery code in try-except blocks to catch HTTPError, OSError, SoCoException, Timeout, and TimeoutError |
homeassistant/components/sonos/const.py |
Defines constants for UPnP issue ID and documentation URL |
homeassistant/components/sonos/strings.json |
Adds user-facing repair issue text explaining UPnP disabled error |
tests/components/sonos/test_init.py |
Adds three new test cases: HTTP 403 during discovery, HTTP 403 during manual host setup, and general exception handling during discovery |
joostlek
left a comment
There was a problem hiding this comment.
You could also consider making this a repair, as then we can just automatically check for the user if it now works and tell them if it doesn't work yet
Proposed change
A recent change to the Sonos firmware has UPnP disabled by default. This prevents the integration from being able to connect. Additionally, when this error occurs it causes a "Unhandled Task Exception" because of lack of error handling in speaker discovery. Two changes
Related to these issues:
#154877
#156328
Docs were addressed in home-assistant/home-assistant.io#42467
Type of change
Additional information
Checklist
ruff format 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.To help with the load of incoming pull requests: