-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add remaining 3 phase electrical attributes #339
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #339 +/- ##
==========================================
+ Coverage 96.50% 96.52% +0.01%
==========================================
Files 61 61
Lines 9455 9499 +44
==========================================
+ Hits 9125 9169 +44
Misses 330 330 ☔ View full report in Codecov by Sentry. |
Instead of trying to set up attribute reporting for attributes that aren't reportable according to spec, just so the EM cluster will poll them with the current implementation, we could also add another Then, we'd have all attributes that need to be initialized in
Another thing, do we really need to poll the |
In that case, won't all the attributes in
To be honest I don't know. Since they were already in |
Yeah, probably all attributes that are in If it looks really stupid to duplicate most/all attributes, we can also combine them in |
As suggested in zigpy#339 (comment) this adds an `ZCL_POLLING_ATTRS` to define attributes that should be polled separatelly from the ones that can have reporting config. This also moves some attributes that do no support reporting config out of `REPORT_CONFIG`.
Opened a PR with the suggested changes: #354 |
@@ -116,7 +143,6 @@ class MeasurementType(enum.IntFlag): | |||
ElectricalMeasurement.AttributeDefs.measurement_type.name: True, | |||
ElectricalMeasurement.AttributeDefs.power_divisor.name: True, | |||
ElectricalMeasurement.AttributeDefs.power_multiplier.name: True, | |||
ElectricalMeasurement.AttributeDefs.power_factor.name: True, |
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.
Ok, I think this is almost good to go now, except for one thing:
All attributes that are exclusively in ZCL_POLLING_ATTRS
like power_factor
(and I guess also the _max
attributes) need to be added to ZCL_INIT_ATTRS
too, with cache=True
, so they're initialized during pairing. Otherwise, the entities will not be created until ZHA is restarted.
(Attributes that are in ATTR_REPORTING
should not be duplicated into ZCL_INIT_ATTRS
though.)
There are some other PRs I want to get in first, so I'll look into slightly changing this behavior in the future, but to have less conflicts with the (IKEA) divisor/multiplier reporting PR, let's just add the three power_factor
and I guess also the ten _max
attributes to ZCL_INIT_ATTRS
.
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.
thanks!
Follow up to #324
Related HA PR: home-assistant/core#133969