-
Notifications
You must be signed in to change notification settings - Fork 80
Fix missing config entity attribute reads #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c63c53
Restore config-entity startup attribute reads dropped in #657
zigpy-review-bot 4829a01
Trim redundant comments on restored startup-read configs
zigpy-review-bot 066d05b
Remove tests for the restored startup reads
zigpy-review-bot 338f83b
Remove read-fresh comments on Danfoss startup-read configs
zigpy-review-bot 976557d
Merge branch 'dev' into zigpy-bot/restore-startup-reads-657
TheJulianJES File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -542,6 +542,7 @@ class HueV1MotionSensitivity(ZCLEnumSelectEntity): | |
| OccupancySensing.AttributeDefs.pir_u_to_o_delay: AttrConfig( | ||
| read_on_startup=False, | ||
| ), | ||
| "sensitivity": AttrConfig(read_on_startup=False), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, planned to do basically. |
||
| }, | ||
| ), | ||
| } | ||
|
|
@@ -573,6 +574,14 @@ class HueV2MotionSensitivity(ZCLEnumSelectEntity): | |
| models=frozenset({"SML002", "SML003", "SML004"}), | ||
| ) | ||
|
|
||
| _server_cluster_config = { | ||
| OccupancySensing.cluster_id: ClusterConfig( | ||
| attributes={ | ||
| "sensitivity": AttrConfig(read_on_startup=False), | ||
| }, | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| class AqaraMonitoringModess(types.enum8): | ||
| """Aqara monitoring modes.""" | ||
|
|
@@ -940,6 +949,16 @@ class SonoffPresenceDetectionSensitivity(ZCLEnumSelectEntity): | |
| models=frozenset({"SNZB-06P", "SNZB-03P"}), | ||
| ) | ||
|
|
||
| _server_cluster_config = { | ||
| OccupancySensing.cluster_id: ClusterConfig( | ||
| attributes={ | ||
| OccupancySensing.AttributeDefs.ultrasonic_u_to_o_threshold: AttrConfig( | ||
| read_on_startup=False, | ||
| ), | ||
| }, | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| class KeypadLockoutEnum(types.enum8): | ||
| """Keypad lockout options.""" | ||
|
|
@@ -1102,6 +1121,7 @@ class DanfossExerciseDayOfTheWeek(ZCLEnumSelectEntity): | |
| Thermostat.AttributeDefs.setpoint_change_source_timestamp: AttrConfig( | ||
| read_on_startup=False, | ||
| ), | ||
| "exercise_day_of_week": AttrConfig(read_on_startup=False), | ||
| }, | ||
| ), | ||
| } | ||
|
|
@@ -1133,6 +1153,12 @@ class DanfossOrientation(ZCLEnumSelectEntity): | |
| exposed_features=frozenset({DANFOSS_ALLY_THERMOSTAT}), | ||
| ) | ||
|
|
||
| _server_cluster_config = { | ||
| Thermostat.cluster_id: ClusterConfig( | ||
| attributes={"orientation": AttrConfig(read_on_startup=False)}, | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| @register_entity(Thermostat.cluster_id) | ||
| class DanfossAdaptationRunControl(ZCLEnumSelectEntity): | ||
|
|
@@ -1149,6 +1175,12 @@ class DanfossAdaptationRunControl(ZCLEnumSelectEntity): | |
| exposed_features=frozenset({DANFOSS_ALLY_THERMOSTAT}), | ||
| ) | ||
|
|
||
| _server_cluster_config = { | ||
| Thermostat.cluster_id: ClusterConfig( | ||
| attributes={"adaptation_run_control": AttrConfig(read_on_startup=False)}, | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| class DanfossControlAlgorithmScaleFactorEnum(types.enum8): | ||
| """The time scale factor for changing the opening of the valve. | ||
|
|
@@ -1190,6 +1222,14 @@ class DanfossControlAlgorithmScaleFactor(ZCLEnumSelectEntity): | |
| exposed_features=frozenset({DANFOSS_ALLY_THERMOSTAT}), | ||
| ) | ||
|
|
||
| _server_cluster_config = { | ||
| Thermostat.cluster_id: ClusterConfig( | ||
| attributes={ | ||
| "control_algorithm_scale_factor": AttrConfig(read_on_startup=False) | ||
| }, | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| @register_entity(UserInterface.cluster_id) | ||
| class DanfossViewingDirection(ZCLEnumSelectEntity): | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I'm not sure how these attributes ended up in the cluster config of this Hue-specific select entity? These are used by a number entity. (Side note: Why does that number entity also include the
occupancyattribute for the binary sensor again?)I'll check to see if other unintentional changes were introduced by that refactor and then remove these in a follow-up PR (to keep this PR as just the fix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the binary sensor also re-adds all the same attributes yet again? Why do all three platforms configure the exact same attributes in the cluster config? We merge these, right..?
zha/zha/application/platforms/binary_sensor/__init__.py
Lines 249 to 260 in c38e03e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a wholesale copy of the old
OccupancySensingClusterHandlerconfig: #657 translated each pre-refactor cluster handler by copying its fullREPORT_CONFIG/ZCL_INIT_ATTRSblock onto every entity class that used that handler — theOccupancybinary sensor, the PIR occupied→unoccupied delay number entity, and this Hue select all got the identicaloccupancy+pir_*_delayblock. The handler's dynamic__init__additions (Huesensitivity, Sonoffultrasonic_*) were dropped in that translation, which is exactly the regression this PR fixes.And yes, they merge:
aggregate_cluster_configs()merges all discovered entities' configs per(endpoint, cluster, direction)—read_on_startupis OR-ed, the tightest reporting wins,bindis OR-ed — so the duplicates are runtime-harmless, but they hide gaps like this one. Two more side effects of the same copy-paste, for the follow-up:PIRUnoccupiedToOccupiedDelayConfigurationEntityhas no cluster config of its own and only works because its sibling's copy happens to includepir_u_to_o_delay.ThermostatLocalTempCalibration(+ Sonoff/Bosch subclasses) andDanfossExerciseDayOfTheWeekcarry the entire 22-attribute thermostat handler block (includingsetpoint_change_source*), andStartupOnOffSelectEntity/OnOffTransitionTimeConfigurationEntity/BegaColorTemperatureChannelSelectcarry the OnOff/LevelControl state blocks.On the entity count: before this PR exactly 12 entity classes are broken on fresh pairing — per device that's 2 missing entities on SNZB-06P/SNZB-03P, 1 on each Hue SML001–SML004, and 8 on a Danfoss Ally. After this PR the only cache-gated entities without a ZHA-side read are the two Tuya
0xEF00ones, which are quirk-seeded by design. (Full audit in my review.)I've pushed the dedup as a follow-up basis on top of this branch:
zigpy-bot/cluster-config-dedup— 5 commits (OccupancySensing / Thermostat / LevelControl / OnOff dedup, each entity now only declaring the attributes it owns, verified by diffing the aggregated per-(cluster, attribute) config view before/after — byte-identical — plus a full test run; and one restore commit for two more #657 losses: Philips SOC0010xFC06bind+reporting and the Legrand cable outlet0xFC40bind, details in the follow-up comment). Happy to open it as a PR once this one lands.