Attributes sharing an ID with a manufacturer-specific definition still break the HA cluster attribute UI (list/read/write)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
The zha-side fix starts in zha/zigbee/device.py, in write_zigbee_attribute, where cluster.find_attribute is called without the manufacturer code; the error labelling is in zha/application/helpers.py, write_attributes_safe. Run tests/test_device.py with a shared-ID case (Innr SP 120 snapshot, ID 0x0000) to reproduce the KeyError. Done means writes with manufacturer 0x1166 and None reach the matching definition, and the HA Core and frontend parts are coordinated, since the WS API shape changes.
Written by the indexing model from the issue text.
Description
Summary
#920 fixed the device-diagnostics part of #798 by iterating cluster.AttributeDefs. The other consumers of attribute definitions still assume that an attribute ID is unique within a cluster. A quirk can legitimately define a manufacturer-specific attribute at the same ID as a ZCL attribute (the Innr SP 120 metering quirk defines current_mfg_summ_delivered at 0x0000 with manufacturer code 0x1166, next to the standard current_summ_delivered). On such a cluster, the "Manage Zigbee device" → Clusters → attributes UI in Home Assistant currently can't list, read, or write those attributes correctly. As noted on #798, this is still an open issue in the HA frontend. This issue tracks the remaining zha, HA Core and frontend work.
What's still broken
Verified on zha dev at 5eb118cc4065221f032221cdcbdfffd383dd139e (zigpy 2.3.0, zha-quirks 2.2.2), using the innr-sp-120-0x11040002.json snapshot:
- The listing drops one definition.
Device.async_get_cluster_attributesreturns zigpy'scluster.attributes, which is keyed by ID only (https://github.com/zigpy/zha/blob/5eb118cc4065221f032221cdcbdfffd383dd139e/zha/zigbee/device.py#L1364). For the SP 120 metering cluster, ID 0x0000 lists onlycurrent_summ_delivered, andcurrent_mfg_summ_deliverednever reaches the UI. HA Core'szha/devices/clusters/attributesthen sends just{id, name}with no manufacturer code (homeassistant/components/zha/websocket_api.pyL607), and the frontend keys the attribute picker onidalone. - Reading the shared ID fails. Without a manufacturer code, the read call fails with
KeyError: Multiple definitions exist for attribute ID 0x0000, please specify a manufacturer code. The read WS command only accepts an integer ID (websocket_api.pyL701), and the frontend sends no manufacturer unless the "Manufacturer code override" field is filled. So even the standardcurrent_summ_deliveredcan't be read from the UI on this device. - zha's write ignores the manufacturer code.
Device.write_zigbee_attributeresolves the attribute withcluster.find_attribute(attribute)before writing, without passing the manufacturer (https://github.com/zigpy/zha/blob/5eb118cc4065221f032221cdcbdfffd383dd139e/zha/zigbee/device.py#L1396). For a shared ID it raises the sameKeyErrorwhatever manufacturer is passed: none,0x1166, orNone. - Related: the manufacturer override no longer works the way the UI and service describe it. zigpy now resolves a definition by (ID, manufacturer code). Passing a manufacturer code that no definition has, e.g. a code on a standard attribute, raises
KeyError. Thezha.set_zigbee_cluster_attributeservice documents-1as "force no code to be set", but HA forwards-1unchanged (services.pyL111) and zigpy raisesKeyError: -1. - Minor: when a write fails,
write_attributes_safelabels the error viacluster.attributes[record.attrid](https://github.com/zigpy/zha/blob/5eb118cc4065221f032221cdcbdfffd383dd139e/zha/application/helpers.py#L117), which can name the wrong definition for a shared ID.
Existing work: dmulcahey's frontend and core branches
Two unmerged branches from 2026-09-06 already cover most of the HA side (no PRs opened for them yet):
- HA Core: https://github.com/home-assistant/core/compare/dev...dmulcahey:home-assistant:dm/zha-manage-device-attr-ui
- Frontend: https://github.com/home-assistant/frontend/compare/dev...dmulcahey:home-assistant-polymer:dm/zha-manage-device-cluster-attr-form
What they do for this problem:
- Core lists attributes from
cluster.AttributeDefs, including the manufacturer-specific duplicates. For each attribute it sendsmanufacturer_codeandis_manufacturer_specific, along with type, access and a form schema. - Core's read command also accepts an attribute name, and resolves the definition with the manufacturer code.
- The core write service maps
-1toNoneand does the manufacturer-aware lookup itself, which bypasses zha'swrite_zigbee_attribute(item 3). - The frontend keys attributes by (id, name, manufacturer code) and labels manufacturer-specific ones with their code. It reads and writes by name together with the definition's own manufacturer code.
Beyond this issue, the branches also add typed form schemas (structs, lists, enums) for attribute values and command arguments.
Things to settle before upstreaming:
- The WS API shape changes.
zha/devices/clusters/attributesgoes from[{id, name}]to[{schema, zcl_attribute: {...}}], and the attribute read returns a typed value instead of a string. The core and frontend PRs have to ship in the same release. - The manual "Manufacturer code override" field is removed for both attributes and commands. Commands are then issued without an explicit manufacturer code. That fits zigpy's definition-driven model (item 4), but it drops the escape hatch for commands that have no manufacturer-specific definition.
- Both branches are far behind (core by ~2000 commits, frontend by ~400) and need a rebase.
Proposed fixes
- zha: pass the manufacturer in
write_zigbee_attribute(cluster.find_attribute(attribute, manufacturer_code=manufacturer)). I tested this locally on the SP 120 snapshot. Withmanufacturer=0x1166the write goes tocurrent_mfg_summ_delivered, and withNoneit goes to the standard attribute. Calling it without a manufacturer still raises, which is correct for an ambiguous ID.tests/test_device.pypasses with the change. This lets HA keep calling zha instead of re-implementing the write. - zha: give HA an accessor that returns every definition (e.g. a list from
AttributeDefs), or let HA iteratecluster.AttributeDefsdirectly as the core branch does. Keep the dict-returningasync_get_cluster_attributesunchanged, so it doesn't silently change its contract. - zha: label
write_attributes_safefailures from the attributes that were actually written, not fromcluster.attributes. - HA Core: list from
AttributeDefswith manufacturer metadata, accept names in the read command, and map-1toNone(the core branch above). - Frontend: key by (id, name, manufacturer code), and read/write with the definition's code (the frontend branch above).
Context: #798, #920
How this was checked
- Ran a probe test against the SP 120 snapshot at zha dev 5eb118cc.
async_get_cluster_attributes(1, 0x0702)lists onlycurrent_summ_deliveredfor ID 0x0000.write_zigbee_attribute(1, 0x0702, 0, 5, manufacturer=...)raisesKeyError: Multiple definitions exist…for no manufacturer,0x1166andNone.cluster.read_attributes([0])raises the same. - With the one-line
find_attribute(..., manufacturer_code=manufacturer)change, writes with0x1166andNonereachcluster.write_attributeswith the matching manufacturer.tests/test_device.pypasses (68 tests). - zigpy 2.3.0:
OnOff.find_attribute(start_up_on_off.id, manufacturer_code=-1)andmanufacturer_code=0x1234both raiseKeyError, andmanufacturer_code=Noneresolves the standard attribute. - HA Core and frontend: read on current
dev. The branch behaviour comes from their diffs against the merge base.
Also related (comment below):
- 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