Add support for frient Electricity Meter Interface 2, LED (EMIZB-141)#4980
Open
marcintyminski wants to merge 6 commits intozigpy:devfrom
Open
Add support for frient Electricity Meter Interface 2, LED (EMIZB-141)#4980marcintyminski wants to merge 6 commits intozigpy:devfrom
marcintyminski wants to merge 6 commits intozigpy:devfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4980 +/- ##
=======================================
Coverage 93.07% 93.07%
=======================================
Files 401 401
Lines 13305 13306 +1
=======================================
+ Hits 12384 12385 +1
Misses 921 921 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds/extends a ZHA v2 quirk for the frient Electricity Meter Interface 2, LED (EMIZB-141) to allow users to set the “current summation delivered” value (and verify it via tests).
Changes:
- Updates the manufacturer-specific
current_summationattribute to be readable + writable. - Exposes
current_summationas a configurable Number entity (Wh) on endpoint 2. - Adds tests to validate entity metadata and manufacturer-specific write behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
zhaquirks/develco/emi_led.py |
Enables read/write access for current summation and adds a Number entity for user alignment of meter readings. |
tests/test_develco.py |
Adds metadata and write-request tests for the EMIZB-141 quirk. |
Comment on lines
+52
to
+64
| .number( | ||
| # Allow a user to set the current summation value, so it can show the same value as the physical meter. | ||
| attribute_name=ManufacturerMetering.AttributeDefs.current_summation.name, | ||
| cluster_id=ManufacturerMetering.cluster_id, | ||
| endpoint_id=2, | ||
| min_value=0, | ||
| max_value=281474976710655, | ||
| step=1, | ||
| unit="Wh", | ||
| mode="box", | ||
| translation_key="current_summation", | ||
| fallback_name="Current summation delivered", | ||
| ) |
Comment on lines
+184
to
+201
| assert request_mock.call_count == 1 | ||
| assert request_mock.call_args[0] == () | ||
| assert request_mock.call_args[1]["cluster"] == Metering.cluster_id | ||
| assert ( | ||
| request_mock.call_args[1]["data"] | ||
| == b"\x04\xd2\x04\x01\x02\x01\x03%\xd2\x04\x00\x00\x00\x00" | ||
| ) | ||
|
|
||
| zcl_header, attr_data = foundation.ZCLHeader.deserialize( | ||
| request_mock.call_args[1]["data"] | ||
| ) | ||
| assert ( | ||
| zcl_header.frame_control.frame_type == foundation.FrameType.GLOBAL_COMMAND | ||
| ) | ||
| assert zcl_header.frame_control.is_manufacturer_specific == 1 | ||
| assert zcl_header.manufacturer == 1234 | ||
| assert zcl_header.command_id == foundation.GeneralCommand.Write_Attributes | ||
| assert attr_data == b"\x01\x03%\xd2\x04\x00\x00\x00\x00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
The quirk has been made to extend functionality of a frient Electricity Meter Interface 2, LED with model no. EMIZB-141.
The change introduced in this pull request adds a setter for current summation delivered, so the user can align it with reading from physical meter.
Additional information
Device diagnostics
zha-01KJYXWD9VV3FMNDJEFN115MC4-frient A_S EMIZB-141-05c92b77056a6a986a950df6acb3b17c.json
Checklist
pre-commitchecks pass / the code has been formatted using Black