8000 Bump zigpy from 0.79.0 to 0.79.1 by dependabot[bot] · Pull Request #448 · zigpy/zha · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Conversation

dependabot[bot]
Copy link
Contributor
@dependabot dependabot bot commented on behalf of github May 6, 2025

Bumps zigpy from 0.79.0 to 0.79.1.

Release notes

Sourced from zigpy's releases.

0.79.1

What's Changed

Full Changelog: zigpy/zigpy@0.79.0...0.79.1

Commits

Dependabot compatibility score

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)

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>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels May 6, 2025
@TheJulianJES
Copy link
Contributor
TheJulianJES commented May 6, 2025

Regenerated diagnostics due to the changed metering attribute types and names.

@TheJulianJES
Copy link
Contributor
TheJulianJES commented May 6, 2025

Also adjusted the tests to match, but I'm not sure they're actually correct(?)
So, please confirm that the precision loss is expected before merging the PR: 5d7cd9b (#448)

CI also isn't starting for some reason... I'll close and reopen this PR.

This comment was marked as outdated.

@TheJulianJES TheJulianJES reopened this May 6, 2025
Copy link
codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.91%. Comparing base (ecb2b9b) to head (5d7cd9b).
Report is 2 commits behind head on dev.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -491,14 +491,14 @@
{
"id": "0x0314",
"name": "alternative_consumption_formatting",
"zcl_type": "map8",
"zcl_type": "uint8",
Copy link
Contributor

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.

Copy link
Contributor

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}}"

Copy link
Contributor Author
dependabot bot commented on behalf of github May 8, 2025

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.

@puddly
Copy link
Contributor
puddly commented May 8, 2025

I'm closing this PR in favor of the (soon-to-be-created) dependabot PR for 0.80.0.

@puddly puddly closed this May 8, 2025
@dependabot dependabot bot deleted the dependabot/pip/zigpy-0.79.1 branch May 8, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0