Skip to content

Add support for frient Electricity Meter Interface 2, LED (EMIZB-141)#4980

Open
marcintyminski wants to merge 6 commits intozigpy:devfrom
marcintyminski:Emi-2-led
Open

Add support for frient Electricity Meter Interface 2, LED (EMIZB-141)#4980
marcintyminski wants to merge 6 commits intozigpy:devfrom
marcintyminski:Emi-2-led

Conversation

@marcintyminski
Copy link
Copy Markdown
Contributor

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

2 LED after change

Device diagnostics

zha-01KJYXWD9VV3FMNDJEFN115MC4-frient A_S EMIZB-141-05c92b77056a6a986a950df6acb3b17c.json

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.07%. Comparing base (3bfbd04) to head (f8772c4).
⚠️ Report is 1 commits behind head on dev.

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.
📢 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.

Copilot AI review requested due to automatic review settings May 7, 2026 06:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_summation attribute to be readable + writable.
  • Exposes current_summation as 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 thread tests/test_develco.py
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"
@TheJulianJES TheJulianJES added the manufacturer This request was made by the device's manufacturer label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manufacturer This request was made by the device's manufacturer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants