-
Notifications
You must be signed in to change notification settings - Fork 61
Remove legacy hardcoded attributes for lumi.airrtc.agl001 #621
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
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #621 +/- ##
==========================================
- Coverage 97.01% 97.00% -0.02%
==========================================
Files 63 63
Lines 10569 10508 -61
==========================================
- Hits 10254 10193 -61
Misses 315 315 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 only initializes the attributes during pairing/reconfiguration for ZHA entities. (This is automatically done by entities defined with v2 quirks.)
The ZHA entities themselves are defined in the relevant ZHA platforms. Search the repo for the model string (here). They need to be removed from there.
Also, we should set the unique_id_suffix for the v2 quirk defined entities accordingly to match what the ZHA entities auto-generated. It should be something like this: 1-64704-child_lock (endpoint id + cluster id + ZHA unique id suffix).
Otherwise, users would see new entities and we'd break old ones. We can't do that.
|
Thanks for the detailed explanation @TheJulianJES! You're absolutely right - I misunderstood where the actual entity definitions come from. I've now added
This should ensure that the quirk entities "take over" the existing legacy entity IDs, preventing duplicates and preserving user automations/dashboards. Given this approach, is this PR (#621) still needed? Or would the |
|
The ZHA entities can be removed if they're all properly replaced by the quirks entities. Refer to my message above on what else needs to be done in this PR:
|
The Aqara E1 TRV (lumi.airrtc.agl001) now has a proper quirk in zha-device-handlers that defines all necessary entities using the quirks v2 API. This PR removes: - ZCL_INIT_ATTRS from OppleRemoteClusterHandler (manufacturerspecific.py) - Legacy entity classes from platform files: - binary_sensor: WindowOpen, ValveAlarm, Calibrated, ExternalSensor - switch: WindowDetection, ValveDetection, ChildLock - select: ThermostatPreset (and PresetMode enum) - number: AwayTemp These legacy definitions create duplicate entities alongside the quirk-defined ones, confusing users with both legacy (translated) and quirk (English) entity names. Removing these eliminates duplicates once the improved quirk (zigpy/zha-device-handlers#4604) is merged. Closes zigpy#620
c7835d0 to
01cdc36
Compare
|
I've expanded this PR to also remove the legacy entity class definitions from the platform files: Removed:
Total: 128 lines removed across 5 files I tested locally and confirmed that these legacy entity classes were indeed creating duplicates:
The This PR should now properly eliminate all duplicates when paired with the quirk PR (zigpy/zha-device-handlers#4604). |
From my previous message:
You need to add the endpoint id and cluster id in v2 quirks UID, only then add the ZHA unique ID suffix. The example I mentioned should work for the child lock entity. The rest are very similar. |
Summary
Removes legacy hardcoded entity definitions for the Aqara E1 TRV (
lumi.airrtc.agl001).The device now has a proper quirk in zha-device-handlers that defines all necessary entities using the quirks v2 API (see zigpy/zha-device-handlers#4604).
Problem
These legacy definitions create duplicate entities alongside the quirk-defined ones:
This confuses users who see both sets of entities for the same functionality.
Changes
Removed from
manufacturerspecific.py:ZCL_INIT_ATTRSblock forlumi.airrtc.agl001inOppleRemoteClusterHandlerRemoved from platform files:
binary_sensor/__init__.pyAqaraThermostatWindowOpen,AqaraThermostatValveAlarm,AqaraThermostatCalibrated,AqaraThermostatExternalSensorswitch.pyAqaraThermostatWindowDetection,AqaraThermostatValveDetection,AqaraThermostatChildLockselect.pyAqaraThermostatPresetMode(enum),AqaraThermostatPresetnumber/__init__.pyAqaraThermostatAwayTempTotal: 128 lines removed
Test Plan
Related
Thanks to @TheJulianJES for explaining that
ZCL_INIT_ATTRSalone doesn't create entities - the actual entity classes in platform files needed to be removed as well!