Follow-ups from the #884 review: override discard logging, quirk-provided test config, DEFAULT test fixture
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
Research direction
Start with aggregate_cluster_configs in zha/zigbee/cluster_config.py around line 119, where attr_name and the cluster are available, and compare the aggregate before and after the merge to log discarded overrides; a prototype commit is referenced in the issue. For the test side, DEFAULT in tests/test_cluster_config.py (line 23) should be replaced by asserting configured[em_attrs.active_power] != RELAXED. The QuirkBuilder change is blocked on a zhaquirks release, so leave that for later. Done means the discard is logged and the test no longer pins ZHA's built-in default.
Written by the indexing model from the issue text.
Description
Tracking the inline review comments from #884 that were deliberately deferred rather than addressed in that PR. Filed at TheJulianJES's request (https://github.com/zigpy/zha/pull/884#discussion_r3919402668). All three still apply on dev at 66603431. The one genuine bug from that review is filed separately.
1. Log when an entity's reporting config is discarded by an override
https://github.com/zigpy/zha/pull/884#discussion_r3910746401
Whether an override wins depends on which entities happened to be discovered, and the discard is otherwise invisible: ClusterConfigureReportingEvent carries only the final result, so "why did this device's voltage reporting get slower after an update" has no answer in a normal ZHA debug log and no way to attribute it to a particular entity.
AggregatedAttrConfig.merge does not know the attribute name, so this wants either the name passed in or the log placed at the aggregate_cluster_configs call site (zha/zigbee/cluster_config.py:119), which already has attr_name and the cluster and can compare the aggregate before and after the merge.
TheJulianJES prototyped it as 66044f4ffbfba5ba8cea487f471448922b515ce5 and left it out of #884.
2. Switch the override test to a real QuirkBuilder-provided config
https://github.com/zigpy/zha/pull/884#discussion_r3910699558
test_cluster_config.py patches ElectricalMeasurementRMSCurrent._server_cluster_config to simulate a device-specific override. TheJulianJES's note: this should become a quirks QuirkBuilder actually providing the override config, which needs the zhaquirks bump, which needs a ZHA release containing #884. Patching internals was accepted as the interim.
3. DEFAULT in test_cluster_config.py silently pins ZHA's built-in active_power config
https://github.com/zigpy/zha/pull/884#discussion_r3910746384
DEFAULT = ReportingConfig(min_interval=5, max_interval=900, reportable_change=1) (tests/test_cluster_config.py:23) is not a free-standing fixture — the final assertion configured[em_attrs.active_power] == DEFAULT only holds because it duplicates what ElectricalMeasurementActivePower._server_cluster_config declares for active_power (zha/application/platforms/sensor/init.py:1074-1079). Still identical on dev.
That reportable_change=1 is exactly what the divisor-aware EM reporting follow-up changes, so this assertion will fail on that PR for a reason unrelated to what the test is about. The test's real subject is that the override did not leak to attributes that did not ask for it, which assert configured[em_attrs.active_power] != RELAXED states without pinning the default.
Low priority — it fails loudly and is a one-line fix — but worth knowing before the divisor-aware change lands.
- Dominant language
- Python
- Stars
- 96
- Forks
- 84
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 30
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zigpy/zha
-
Device override creates the generic entity instead of the vendor-specific one (Light instead of HueLight, ForceOnLight, MinTransitionLight)Possibly taken @zigpy-review-bot claimed this today. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Each time a device becomes available again, ZHA adds another firmware update listener that is never releasedPossibly taken @zigpy-review-bot claimed this 1 day ago. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Devices that left the network are re-initialized on every availability check, reading attributes from a device that is gonePossibly taken @zigpy-review-bot claimed this 1 day ago. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
device specific quirks
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
QuantConnect/lean-cli#792 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35360 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100