Add quality scale for WLED#155482
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
|
| "init": { | ||
| "data": { | ||
| "keep_master_light": "Add 'Main' control even with single LED segment" | ||
| }, |
There was a problem hiding this comment.
For unknown reason, pytest started reporting the error:
FAILED tests/components/wled/test_config_flow.py::test_options_flow - Failed: Translation not found for wled: `options.step.init.data_description.keep_master_light`. Please add to homeassistant/components/wled/strings.json
data_description should be optional fields, but it is not always true.
There was a problem hiding this comment.
They are not optional... just because it works without doesn't make them optional and it is a check that get introduced as part of the quality scale checks
There was a problem hiding this comment.
I relied on the documentation which says it is optional.

https://developers.home-assistant.io/docs/data_entry_flow_index/#labels--descriptions
Since this is the entrypoint for users to start using an integration, we should make sure that the config flow is very user-friendly and understandable.
This means we should use the right selectors at the right place, validate the input where needed, and usedata_descriptionin thestrings.jsonto give context about the input field.
I found another text that describes this, and it also doesn't say it's required explicitly. This could be interpreted as meaning that config flow should be user-friendly, and one way to do this is by using data_description.
There was a problem hiding this comment.
Thank you also very much for explaining where this error message comes from.
There was a problem hiding this comment.
Pull Request Overview
This pull request implements the parallel-updates Silver tier quality scale requirement for the WLED integration. The changes add the PARALLEL_UPDATES constant to platform files that were missing it, bringing the integration into compliance with Silver tier quality scale rules.
- Adds
PARALLEL_UPDATES = 0tobutton.py,sensor.py, andupdate.pyplatforms - Creates
quality_scale.yamltracking file documenting the integration's quality scale compliance status - Removes WLED from the exemption list in the quality scale validation script
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| script/hassfest/quality_scale.py | Removes WLED from the parallel-updates rule exemption list |
| homeassistant/components/wled/quality_scale.yaml | Adds comprehensive quality scale tracking file with rule status for Bronze, Silver, Gold, and Platinum tiers |
| homeassistant/components/wled/button.py | Adds PARALLEL_UPDATES = 0 constant with explanatory comment |
| homeassistant/components/wled/sensor.py | Adds PARALLEL_UPDATES = 0 constant with explanatory comment |
| homeassistant/components/wled/update.py | Adds PARALLEL_UPDATES = 0 constant with explanatory comment |
| # Coordinator is used to centralize the data updates | ||
| PARALLEL_UPDATES = 0 |
There was a problem hiding this comment.
The comment "Coordinator is used to centralize the data updates" doesn't explain why PARALLEL_UPDATES = 0 was chosen. According to the coding guidelines, PARALLEL_UPDATES = 0 means unlimited concurrent updates and is appropriate for coordinator-based platforms. Consider clarifying this in the comment, such as: "# Coordinator-based platform, unlimited parallel updates (PARALLEL_UPDATES = 0)"
| # Coordinator is used to centralize the data updates | ||
| PARALLEL_UPDATES = 0 |
There was a problem hiding this comment.
The comment "Coordinator is used to centralize the data updates" doesn't explain why PARALLEL_UPDATES = 0 was chosen. According to the coding guidelines, PARALLEL_UPDATES = 0 means unlimited concurrent updates and is appropriate for coordinator-based platforms. Consider clarifying this in the comment, such as: "# Coordinator-based platform, unlimited parallel updates (PARALLEL_UPDATES = 0)"
| # Coordinator is used to centralize the data updates | ||
| PARALLEL_UPDATES = 0 |
There was a problem hiding this comment.
The comment "Coordinator is used to centralize the data updates" doesn't explain why PARALLEL_UPDATES = 0 was chosen. According to the coding guidelines, PARALLEL_UPDATES = 0 means unlimited concurrent updates and is appropriate for coordinator-based platforms. Consider clarifying this in the comment, such as: "# Coordinator-based platform, unlimited parallel updates (PARALLEL_UPDATES = 0)"
| entity-translations: done | ||
| exception-translations: todo | ||
| icon-translations: done | ||
| reconfiguration-flow: todo |
There was a problem hiding this comment.
| comment: | | ||
| I see two problems: | ||
| - Unsupported WLED version. | ||
| - MAC address mismatch e.g. we connect to the device, but |
There was a problem hiding this comment.
This problem is covered by: https://github.com/home-assistant/core/pull/155491/files
| comment: This integration does not have custom service actions. | ||
| docs-high-level-description: done | ||
| docs-installation-instructions: done | ||
| docs-removal-instructions: todo |
There was a problem hiding this comment.
PR is ready: home-assistant/home-assistant.io#41534
There was a problem hiding this comment.
Merged. I bumped quality scale to bronze now.
epenet
left a comment
There was a problem hiding this comment.
Please move all code changes to separate PRs
Keep this PR for ONLY the quality_scale.yaml + quality_scale.py changes
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
354b6bd to
ee28068
Compare
f55b694 to
461bba3
Compare
| comment: | | ||
| This integration has a fixed single device. | ||
| entity-category: done | ||
| entity-device-class: done |
There was a problem hiding this comment.
led count could receive unit ofmeasurement for LED
| @@ -0,0 +1,78 @@ | |||
| rules: | |||
There was a problem hiding this comment.
maybe the nightlight could eventually become their own entity
There was a problem hiding this comment.
I'm not sure I understand. "Nightlight" is a timer that turns the light off after a certain time, so the switch type seems fine to me.
There was a problem hiding this comment.
Sorry, there are extra state attributes that might warrant their own entity
There was a problem hiding this comment.
I'm not sure if many people use the nightlight in WLED if the same can be done in HA. This entity mainly collects history when someone triggered it from the WLED UI.
| config-entry-unloading: done | ||
| docs-configuration-parameters: done | ||
| docs-installation-parameters: todo | ||
| entity-unavailable: done |
There was a problem hiding this comment.
@property
def available(self) -> bool:
"""Return True if entity is available."""
try:
self.coordinator.data.state.segments[self._segment]
except KeyError:
return False
return super().availableThis can just be an if .. in .. check
| appropriate-polling: done | ||
| brands: done | ||
| common-modules: done | ||
| config-flow-test-coverage: done |
There was a problem hiding this comment.
test_connection_error and test_unsupported_version_error should end in CREATE_ENTRY
| status: exempt | ||
| comment: | | ||
| This integration does not require authentication. | ||
| test-coverage: done |
There was a problem hiding this comment.
test_websocket_already_connected can use the freezer (more tests in the test_coordinator file).
| status: exempt | ||
| comment: | | ||
| This integration does not require authentication. | ||
| test-coverage: done |
There was a problem hiding this comment.
The light platform could use snapshot tests to actually get a snapshot of every fixture light. (not a blocker, just a potential improvement)
| status: exempt | ||
| comment: | | ||
| This integration does not require authentication. | ||
| test-coverage: done |
There was a problem hiding this comment.
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=dt_util.UTC) instead, we should use
@pytest.mark.freeze_time("2023-10-21")| @@ -0,0 +1,78 @@ | |||
| rules: | |||
There was a problem hiding this comment.
The location of the WLED repo has changed btw, so we should update the release URL
| @@ -0,0 +1,78 @@ | |||
| rules: | |||
| # Bronze | |||
| action-setup: done | |||
There was a problem hiding this comment.
but the integration doesn't have actions :)
| action-exceptions: | ||
| status: exempt | ||
| comment: This integration does not have custom service actions. |
There was a problem hiding this comment.
turning on the light also counts as an action for example
Breaking change
Proposed change
Bronze
action-setup- Service actions are registered in async_setupappropriate-polling- If it's a polling integration, set an appropriate polling intervalcore/homeassistant/components/wled/const.py
Lines 14 to 15 in 3377e90
brands- Has branding assets available for the integrationcommon-modules- Place common patterns in common moduleshttps://github.com/home-assistant/core/blob/dev/homeassistant/components/wled/entity.py
https://github.com/home-assistant/core/blob/dev/homeassistant/components/wled/helpers.py
config-flow-test-coverage- Full test coverage for the config flowconfig-flow- Integration needs to be able to be set up via the UIdata_descriptionto give context to fieldsConfigEntry.dataandConfigEntry.optionscorrectlydependency-transparency- Dependency transparencyhttps://github.com/frenck/python-wled/releases/tag/v0.21.0
docs-actions- The documentation describes the provided service actions that can be usedNo actions
docs-high-level-description- The documentation includes a high-level description of the integration brand, product, or servicedocs-installation-instructions- The documentation provides step-by-step installation instructions for the integration, including, if needed, prerequisitesdocs-removal-instructions- The documentation provides removal instructionsNot yet
entity-event-setup- Entity events are subscribed in the correct lifecycle methodsYes. We use coordinator for that.
entity-unique-id- Entities have a unique IDhas-entity-name- Entities use has_entity_name = Trueruntime-data- Use ConfigEntry.runtime_data to store runtime datahass.data[WLED_KEY]is used for coordinator that fetches information about GitHub Releases, but it is okey, as we want to avoid fetching the same data multiple times for each device.test-before-configure- Test a connection in the config flowcore/homeassistant/components/wled/config_flow.py
Lines 47 to 51 in 3377e90
test-before-setup- Check during integration initialization if we are able to set it up correctly.We use coordinator for that.
unique-config-entry- Don't allow the same device or service to be able to be set up twicecore/homeassistant/components/wled/config_flow.py
Lines 52 to 57 in 3377e90
Silver
action-exceptions- Service actions raise exceptions when encountering failuresNo actions.
config-entry-unloading- Support config entry unloadingcore/homeassistant/components/wled/__init__.py
Lines 54 to 64 in 3377e90
Should we also remove release coordinator after last entry removal?
docs-configuration-parameters- The documentation describes all integration configuration optionsdocs-installation-parameters- The documentation describes all integration installation parametersOnly one parameter HOST, but is it undocumented explciite.
entity-unavailable- Mark entity unavailable if appropriateWe use coordinator.
integration-owner- Has an integration ownerYes.
log-when-unavailable- If internet/device/service is unavailable, log once when unavailable and once when back connectedWe use coordinator.
parallel-updates- Number of parallel updates is specifiedreauthentication-flow- Reauthentication needs to be available via the UINo auth.
test-coverage- Above 95% test coverage for all integration modules98%.
Gold
devices- The integration creates devicescore/homeassistant/components/wled/entity.py
Lines 16 to 29 in 3377e90
diagnostics- Implements diagnosticshttps://github.com/home-assistant/core/blob/dev/homeassistant/components/wled/diagnostics.py
discovery-update-info- Integration uses discovery info to update network informationdiscovery- Devices can be discovereddocs-data-update- The documentation describes how data is updateddocs-examples- The documentation provides automation examples the user can use.docs-known-limitations- The documentation describes known limitations of the integration (not to be confused with bugs)docs-supported-devices- The documentation describes known supported / unsupported devicesdocs-supported-functions- The documentation describes the supported functionality, including entities, and platformsdocs-troubleshooting- The documentation provides troubleshooting informationdocs-use-cases- The documentation describes use cases to illustrate how this integration can be useddynamic-devices- Devices added after integration setup.This integration has a fixed single device.
entity-category- Entities are assigned an appropriate EntityCategoryentity-device-class- Entities use device classes where possibleentity-disabled-by-default- Integration disables less popular (or noisy) entitiesentity-translations- Entities have translated namesexception-translations- Exception messages are translatableicon-translations- Entities implement icon translationsreconfiguration-flow- Integrations should have a reconfigure flowrepair-issues- Repair issues and repair flows are used when user intervention is neededstale-devices- Stale devices are removedThis integration has a fixed single device.
Platinum
async-dependency- Dependency is asyncinject-websession- The integration dependency supports passing in a websessionstrict-typing- Strict typingType 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: