-
Notifications
You must be signed in to change notification settings - Fork 43
Bump zigpy from 0.79.0 to 0.79.1 #448
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
Conversation
Bumps [zigpy](https://github.com/zigpy/zigpy) from 0.79.0 to 0.79.1. - [Release notes](https://github.com/zigpy/zigpy/releases) - [Commits](zigpy/zigpy@0.79.0...0.79.1) --- updated-dependencies: - dependency-name: zigpy dependency-version: 0.79.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Regenerated diagnostics due to the changed metering attribute types and names. |
Also adjusted the tests to match, but I'm not sure they're actually correct(?) CI also isn't starting for some reason... I'll close and reopen this PR. |
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #448 +/- ##
=======================================
Coverage 96.91% 96.91%
=======================================
Files 63 63
Lines 10353 10353
=======================================
Hits 10034 10034
Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -491,14 +491,14 @@ | |||
{ | |||
"id": "0x0314", | |||
"name": "alternative_consumption_formatting", | |||
"zcl_type": "map8", | |||
"zcl_type": "uint8", |
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.
Ah, this is a bug! Zigpy should have set zcl_type=map8
on these attributes. They're bitmaps meant to be interepted as integers.
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.
zigpy/zigpy#1596 + zigpy/zigpy#1597 cause these tests to pass correctly. The following patch cleans up ZHA's parsing of this data as well:
diff --git a/zha/zigbee/cluster_handlers/smartenergy.py b/zha/zigbee/cluster_handlers/smartenergy.py
index 293f1ce..849fee8 100644
--- a/zha/zigbee/cluster_handlers/smartenergy.py
+++ b/zha/zigbee/cluster_handlers/smartenergy.py
@@ -17,6 +17,7 @@ from zigpy.zcl.clusters.smartenergy import (
MduPairing,
Messaging,
Metering,
+ NumberFormatting,
Prepayment,
Price,
Tunneling,
@@ -33,6 +34,13 @@ if TYPE_CHECKING:
from zha.zigbee.endpoint import Endpoint
+DEFAULT_FORMATTING = NumberFormatting(
+ num_digits_right_of_decimal=1,
+ num_digits_left_of_decimal=15,
+ suppress_leading_zeros=1,
+)
+
+
@registries.CLUSTER_HANDLER_REGISTRY.register(Calendar.cluster_id)
class CalendarClusterHandler(ClusterHandler):
"""Calendar cluster handler."""
@@ -302,13 +310,13 @@ class MeteringClusterHandler(ClusterHandler):
"""Fetch config from device and updates format specifier."""
fmting = self.cluster.get(
- Metering.AttributeDefs.demand_formatting.name, 0xF9
- ) # 1 digit to the right, 15 digits to the left
+ Metering.AttributeDefs.demand_formatting.name, DEFAULT_FORMATTING
+ )
self._format_spec = self.get_formatting(fmting)
fmting = self.cluster.get(
- Metering.AttributeDefs.summation_formatting.name, 0xF9
- ) # 1 digit to the right, 15 digits to the left
+ Metering.AttributeDefs.summation_formatting.name, DEFAULT_FORMATTING
+ )
self._summa_format = self.get_formatting(fmting)
async def async_update(self) -> None:
@@ -324,19 +332,17 @@ class MeteringClusterHandler(ClusterHandler):
@staticmethod
def get_formatting(formatting: int) -> str:
- """Return a formatting string, given the formatting value.
-
- Bits 0 to 2: Number of Digits to the right of the Decimal Point.
- Bits 3 to 6: Number of Digits to the left of the Decimal Point.
- Bit 7: If set, suppress leading zeros.
- """
- r_digits = int(formatting & 0x07) # digits to the right of decimal point
- l_digits = (formatting >> 3) & 0x0F # digits to the left of decimal point
+ """Return a formatting string, given the formatting value."""
+ formatting = NumberFormatting(formatting)
+ r_digits = formatting.num_digits_right_of_decimal
+ l_digits = formatting.num_digits_left_of_decimal
+
if l_digits == 0:
l_digits = 15
+
width = r_digits + l_digits + (1 if r_digits > 0 else 0)
- if formatting & 0x80:
+ if formatting.suppress_leading_zeros:
# suppress leading 0
return f"{{:{width}.{r_digits}f}}"
A newer version of zigpy exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged. |
I'm closing this PR in favor of the (soon-to-be-created) dependabot PR for 0.80.0. |
Bumps zigpy from 0.79.0 to 0.79.1.
Release notes
Sourced from zigpy's releases.
Commits
b4af006
Implement missing Metering cluster data types (#1594)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)