Behaviour lost or changed when cluster handlers were replaced by entity cluster configs
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- embedded-iot
Research direction
Start with zha/zigbee/cluster_config.py: configure_cluster_configs() calls cluster.find_attribute() outside any try, and the reporting-config merge and read_on_startup handling live there too. Then compare with the old handler logic in zha/zigbee/cluster_handlers/init.py and the claim code in zha/application/discovery.py. Done means each numbered item is either fixed with a test or confirmed as intended with a note on the issue. Expect a maintainer-led design discussion before any patch.
Written by the indexing model from the issue text.
Description
Summary
zigpy/zha#657 (first released in zha 1.4.0) replaced cluster handlers with cluster configs that entities declare. Before it, ZHA bound, configured reporting for and read every cluster handler that something had claimed: an entity match, a quirks v2 entity, or the entity-less CLUSTER_HANDLER_ONLY_CLUSTERS list. Each handler brought its own BIND, REPORT_CONFIG and ZCL_INIT_ATTRS with it. Now ZHA only binds, reports and reads what the discovered entities declare. Most handlers were ported one-to-one, but a few behaviours were lost or changed along the way. This issue lists them so they can be fixed or confirmed as intended. It came up while reviewing zigpy/zha-device-handlers#5663.
The list comes from comparing every handler at cd68bc8c (the parent of the #657 merge) with the entity configs on dev at 2da1a5b5. It was a static code comparison; nothing was observed on a device. Links below are pinned to those two commits.
Behaviour that changed
1. Legrand cable outlet cluster (0xFC40) is no longer bound. LegrandCableOutletClusterHandler was registered in CLUSTER_HANDLER_ONLY_CLUSTERS with the default BIND = True (old, claimed here). Dev has no entity or virtual entity for 0xFC40, and the quirk's pilot wire mode entity has no reporting_config, so its generated config has bind=False (quirk, config generation). Affects Legrand " Cable outlet" devices paired since zha 1.4.0. Pilot wire mode changes made on the device probably no longer reach HA. This is the same gap as zigpy/zha#1046 (Philips 0xFC06), and the only other entity-less handler without a replacement on dev.
2. Quirks v2 entities no longer inherit the standard handler's reporting. Before, a v2 entity without reporting_config still claimed the cluster's handler (old). The handler's own REPORT_CONFIG was then configured, without a bind, and read on initialization (configure, read). On MultistateInput, MultistateOutput, MultistateValue, AnalogValue and BinaryValue, that meant present_value reporting at REPORT_CONFIG_DEFAULT. Now such an entity only gets a read of its own attribute. Examples: PushOk POK006 "Valve status" (MultistateInput) and "Stall time" (MultistateValue) in pok006.py, and POK002/POK007 on MultistateValue. Whether those reports arrived without a bind depends on the device. Quirks that pass reporting_config (bind + reporting) are not affected.
3. Reportable attributes are no longer read from the device on initialization. The old handler added every REPORT_CONFIG attribute to the uncached reads (old). So whenever initialization did not run from cache, they were read from the device: on join, on reconfigure, when a device comes back online, and on the "refresh mains-powered devices on startup" pass. Several replacement configs set read_on_startup=False, and those attributes are now read with allow_cache=True (new). Any cached value is returned and the device is never asked. Affected:
- DoorLock
lock_state(lock) - AnalogInput
present_valueon the generic sensor (sensor; the Digi variant still reads fresh) - the nine IKEA STARKVIND cluster attributes
- the Danfoss thermostat and diagnostic attributes (
open_window_detection,heat_required,load_estimate,adaptation_run_status,preheat_*,sw_error_code,motor_step_counter, …), plus Danfossmounting_mode_control, which was explicitly uncached before (# Can change) and has no reporting - the SmartThings acceleration attributes, Sinope
action_report, and the battery entities'battery_size/battery_quantity - every quirks v2 entity with a
reporting_config(quirks)
The visible effect is a stale state after an HA restart or a device coming back, until the next report. For lock state, that can matter.
4. A quirk's reporting_config is merged with ZHA's default instead of replacing it. Before, the quirk's config for an attribute replaced the handler's entry (old). Now the configs are merged field by field, taking the smallest min interval, max interval and reportable change (new). The quirks builder doesn't set reporting_override. So a quirk can no longer relax a default, and the device can get a mix that neither side asked for. No in-tree quirk relaxes a ZHA default today, so this is latent.
5. One unknown attribute name aborts the whole device configuration. configure_cluster_configs() calls cluster.find_attribute(attr_name) outside any try (new). Device.async_configure() and the join path don't catch it either. A declared reporting attribute that a quirk's replacement cluster lacks raises KeyError. This can come from a quirks v2 entity: the generation code allows names outside the cluster schema (comment). Every cluster after that one is then left unbound and unconfigured, async_initialize() doesn't run on join, and emit_reconfigure_done() is skipped. Before, each handler failed on its own: its exception was swallowed by asyncio.gather(..., return_exceptions=True).
Lower impact or latent
- Configuration is now sequential. Endpoints and handlers used to be configured concurrently (old). Now one loop configures one cluster after another (new). IAS zone enrollment (
cie_addrwrite and enroll response) now waits for the bind and reporting setup of every cluster before it. On sleepy sensors that can push enrollment past the device's awake window. Only the timing has changed; no failure has been observed. skip_configurationnow also skips initialization from cache (new). Before, only the non-cache path was skipped (old). That also drops per-cluster initialization hooks on startup, such as the Aqara motion sensor's detection interval sync. Related to zigpy/zha#1015.- Client clusters are only handled on ZHA and ZLL profile endpoints. Client handlers were created and configured regardless of the endpoint's profile (old). The new matches default to those two profiles (new), with only the LevelControl client bind opting out. No device in ZHA's test data has such an endpoint.
- LevelControl commands received on a light's server cluster no longer update its brightness. The old
LevelControlClusterHandler.cluster_commandforwardedmove_to_level/move/stepto the light (old). The light now only listens for attribute updates. How often this path was reached in practice is unclear. - IKEA cluster 0xFC7D was bound and its nine attributes reported on any device that has it (
CLUSTER_HANDLER_ONLY_CLUSTERS). Now that only happens through the STARKVIND fan match. This only matters if another IKEA device exposes that cluster. - Thermostat subclasses newly bind the Fan cluster. Zehnder, Moes, Beca, Stelpro and ZONNSMART now inherit the Fan cluster config of
Thermostat. This is an extra bind, and harmless.
Already tracked
- zigpy/zha#1046: Philips contact cluster 0xFC06 handler not carried over.
- zigpy/zha#942 (closed): the electrical measurement poller reads multipliers and divisors again.
- zigpy/zha#1050: SmartThings arrival sensor reporting.
- zigpy/zha#1015:
skip_configuration()also skips attribute initialization.
Checked and unchanged
- Reporting configs are identical before and after for OnOff, LevelControl, Color, WindowCovering, DoorLock, PowerConfiguration, Fan, Thermostat (including Danfoss), Metering, Occupancy, the Binary/Analog input and output clusters, all measurement clusters, DeviceTemperature, the SmartThings humidity and acceleration clusters, Sinope
action_reportand the IKEA purifier. - These entity-less handlers have a replacement on dev: Basic, LightLink, IasWd, OSRAM 0xFD00, Philips 0xFC00, Tuya 0xEF00, Aqara Opple, Sonoff 0xFC11, Sinope, IKEA 0xFC7D, 0xFC80 and 0xFC7F (client).
- The initialization attribute sets were carried over: the per-model Opple attributes, Inovelli, the Tuya plug, Sonoff SNZB-06P, Sinope, the Hue, TI and Aqara Basic attributes, Hue and Sonoff occupancy, and Bega level. Two sets were dropped: the
aqara.feeder.acn001attributes, on purpose in zigpy/zha#883, and WindowCovering's fourinstalled_*_limit_*attributes, which no entity uses. - These runtime side effects were ported: IAS enrollment and status notifications, LightLink group join, the OnOff client cache sync and events, the Scenes, Level, Color and WindowCovering client events, the OTA
query_next_imageversion cache, DoorLockoperation_event_notification, SmartThings acceleration events and Identify. _discovered_entitiesincludes entities that are disabled by default and entities a quirk removes, so their configs still count, the same as the old claim during discovery.- The handlers with
BIND = False(Basic, Identify, Ota, LightLink, Groups, GreenPower) are still not bound by any ZHA entity. - MultistateInput was not configured on its own before zigpy/zha#657 either. Its handler had a
REPORT_CONFIG, but no ZHA entity used the cluster and it was not inCLUSTER_HANDLER_ONLY_CLUSTERS. It was only configured when a quirks v2 entity claimed it (item 2).
- 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