Handle unsupported version in WLED#157778
Conversation
|
Hey there @frenck, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
| try: | ||
| device = await self._async_get_device(user_input[CONF_HOST]) | ||
| except WLEDUnsupportedVersionError: | ||
| errors["base"] = "unsupported_version" |
There was a problem hiding this comment.
Ideally, I'd like to display the original error message here as well, but I have no idea how to do that. Any ideas?
There was a problem hiding this comment.
You can use placeholders, but that isn't meant for big errors tbf
There was a problem hiding this comment.
Now that we have this merged, I’m not going to worry about it any further.
Thank you very much for the quick review. It genuinely made me happy to see this change merged so fast. My previous PR for the WLED integration waited several months before it finally got merged, and this time we were even faster than the GitHub copilot.
My next step is the quality scale, since that was one of the missing pieces: #155482
There was a problem hiding this comment.
Pull request overview
This PR adds proper handling for unsupported WLED firmware versions by catching WLEDUnsupportedVersionError exceptions throughout the integration and providing appropriate user feedback.
- Handles unsupported version errors in both config flow (user and zeroconf) and coordinator
- Raises
ConfigEntryErrorwith translatable messages when unsupported versions are detected - Adds comprehensive test coverage for the new error handling paths
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/wled/coordinator.py | Catches WLEDUnsupportedVersionError in data update and raises ConfigEntryError with translation support |
| homeassistant/components/wled/config_flow.py | Handles unsupported version errors in both user and zeroconf flows with appropriate error/abort responses |
| homeassistant/components/wled/strings.json | Adds translation keys for unsupported version errors in config flow and exceptions sections |
| tests/components/wled/test_coordinator.py | Adds test verifying that setup fails with proper error message when encountering unsupported versions |
| tests/components/wled/test_config_flow.py | Adds tests for unsupported version handling in both user and zeroconf discovery flows |
| "message": "MAC address does not match the configured device. Expected to connect to device with MAC: {expected_mac}, but connected to device with MAC: {actual_mac}." | ||
| }, | ||
| "unsupported_version": { | ||
| "message": "The WLED device's firmware version is not supported: {error}" |
There was a problem hiding this comment.
The error message lacks actionable guidance for users. According to the coding guidelines, error messages should be clear and helpful. Consider providing specific steps users can take to resolve the issue, such as:
"message": "The WLED device's firmware version is not supported: {error}. Please update your WLED device firmware to a supported version."This gives users a clear action they can take to resolve the problem.
| "message": "The WLED device's firmware version is not supported: {error}" | |
| "message": "The WLED device's firmware version is not supported: {error}. To fix this issue, please update your WLED device to the latest firmware version. You can find update instructions on the WLED website (https://kno.wled.ge/firmware-updates/) or in the WLED app." |
Co-authored-by: mik-laj <12058428+mik-laj@users.noreply.github.com>
Breaking change
Proposed change
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: