Skip to content
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

Support configuration of entity reporting for V2 quirks #254

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

benbancroft
Copy link
Contributor

Proposed change

This change hooks up the V2 Quirk report_config option to the cluster handler created for V2 quirks. It also 'claims' the cluster, which is required for reporting and binding hooks to work upon configuration of the cluster and previously wasn't being done for V2 Quirk clusters.

Screenshot 2024-10-21 111956

Additional information

Please refer to zigpy/zigpy#1490 for more information on the motivation behind this patch. This patch will need to be merged after that has been merged and zigpy dependency has been bumped.

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.33%. Comparing base (69abf69) to head (b9267d7).
Report is 6 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #254   +/-   ##
=======================================
  Coverage   96.33%   96.33%           
=======================================
  Files          61       61           
  Lines        9388     9395    +7     
=======================================
+ Hits         9044     9051    +7     
  Misses        344      344           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@dmulcahey
Copy link
Contributor

needs a rebase

@benbancroft
Copy link
Contributor Author

@dmulcahey I've just force pushed a rebase. The tests will continue to fail however, as this patch has dependeny on the zigpy PR, so this will require a further rebase once that merges.

@dmulcahey
Copy link
Contributor

@dmulcahey I've just force pushed a rebase. The tests will continue to fail however, as this patch has dependeny on the zigpy PR, so this will require a further rebase once that merges.

My bad.. sorry for the unnecessary ping!!

@benbancroft
Copy link
Contributor Author

I've just rebased against zigpy dependency update. All tests should now be passing.


cluster_handler.__dict__[zha_const.REPORT_CONFIG] = reporting_config

endpoint.claim_cluster_handlers([cluster_handler])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting (for myself) that claiming a cluster handler is what also makes ZHA configure and bind the cluster.

),
)

cluster_handler.__dict__[zha_const.REPORT_CONFIG] = reporting_config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attributes are also added to ZCL_INIT_ATTRS above this new code block.

If I'm looking at this correctly, we'll have them in both REPORT_CONFIG and ZCL_INIT_ATTRS and then have duplicates in uncached?

cached = [a for a, cached in self.ZCL_INIT_ATTRS.items() if cached]
uncached = [a for a, cached in self.ZCL_INIT_ATTRS.items() if not cached]
uncached.extend([cfg["attr"] for cfg in self.REPORT_CONFIG])

We might want to move the new block before the ZCL_INIT_ATTRS block and then check in the ZCL_INIT_ATTRS block that they're not already in REPORT_CONFIG OR just remove them from ZCL_INIT_ATTRS in this line?

@TheJulianJES TheJulianJES added quirks Quirks related waiting for reply Waiting for a reply (e.g. to test a custom quirk) labels Nov 24, 2024
@ikruglov
Copy link

Hi.

Thanks for coming up with a proper solution for the problem of the Ikea VINDSTYRKA sensor's VOC index not being updated.

I want to say that this patch, together with my quirk (ikruglov/zha-device-handlers@c49d8e1), works well. I now have a properly updating VOC Index without workarounds, such as manually reading values.

I'd be happy to submit the PR for the quirk, but I thought you may already have one. So, I'll keep it to myself, meanwhile.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quirks Quirks related waiting for reply Waiting for a reply (e.g. to test a custom quirk)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants