Skip to content

feat(zigbee): Add AC DC ElectricalMeasurement support #11384

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

P-R-O-C-H-Y
Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y commented May 21, 2025

Description of Change

This pull request introduces a new Zigbee Electrical measurement endpoint support, containing support for both DC and AC(single or multi phase).

Added 3 new examples showing how the Electrical Measurement can be configured and used.

Tests scenarios

Tested using the new examples flashed on ESP32-C6 and connecting to a coordinator running on HomeAssistant ZHA.

NOTE: DC measurement is currently not supported by HA ZHA - pending PR here: zigpy/zha#453

Screenshot of AC multiphase example in HA
Screenshot 2025-05-21 at 8 25 03

Related links

Closes #11277

@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this May 21, 2025
@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Review needed Issue or PR is awaiting review Area: Zigbee Issues and Feature Request about Zigbee labels May 21, 2025
Copy link
Contributor

github-actions bot commented May 21, 2025

Messages
📖 This PR seems to be quite large (total lines of code: 1927), you might consider splitting it into smaller PRs

👋 Hello P-R-O-C-H-Y, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against a42cb64

Copy link
Contributor

Test Results

 76 files   76 suites   12m 45s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit a42cb64.

@P-R-O-C-H-Y P-R-O-C-H-Y requested a review from Copilot May 21, 2025 08:38
Copy link
Contributor

@Copilot 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

This PR adds support for Electrical Measurement (both DC and AC, single- and multi-phase) in the Zigbee library, along with example sketches, configuration files, and documentation updates.

  • Introduces ZigbeeElectricalMeasurement endpoint class with DC and AC measurement APIs
  • Registers the new endpoint in core headers/CMakeLists and provides three fully documented examples (DC, AC single-phase, AC multi-phase)
  • Supplies CI configs and README updates for each example

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libraries/Zigbee/src/ep/ZigbeeElectricalMeasurement.h Defines new endpoint class and measurement enums/APIs
libraries/Zigbee/src/Zigbee.h Includes new ElectricalMeasurement endpoint header
CMakeLists.txt Adds implementation source to build
libraries/Zigbee/examples/Zigbee_Electrical_DC_Sensor/* DC example sketch, CI config, and README
libraries/Zigbee/examples/Zigbee_Electrical_AC_Sensor/* AC single-phase example sketch, CI config, and README
libraries/Zigbee/examples/Zigbee_Electrical_AC_Sensor_MultiPhase/* AC multi-phase example sketch, CI config, and README
Comments suppressed due to low confidence (2)

libraries/Zigbee/src/ep/ZigbeeElectricalMeasurement.h:1

  • Update the class-level comment to reference ElectricalMeasurement rather than Pressure sensor to accurately describe the new endpoint.
/* Class of Zigbee Pressure sensor endpoint inherited from common EP class */

libraries/Zigbee/src/ep/ZigbeeElectricalMeasurement.h:98

  • [nitpick] The field name measure_type is ambiguous; consider renaming to measurement_types_bitmask or measured_types for clarity.
  uint32_t measure_type = 0x0000;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Zigbee Issues and Feature Request about Zigbee Status: Review needed Issue or PR is awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Zigbee Electrical Measurement
2 participants