Skip to content
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

feat(zigbee): Add battery voltage attribute support #11210

Merged
merged 5 commits into from
Apr 9, 2025

Conversation

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

Description of Change

This pull request includes updates to the Zigbee Power Config Cluster adding a battery voltage functionality. The most important changes involve adding support for setting and reporting battery voltage in addition to battery percentage.

Enhancements to battery management:

Note: Battery Voltage attribute is not reportable, that's why there is no report method for that.

Tests scenarios

Tested using Sleepy example and HomeAssistant ZHA integration (only battery % was shown, but I was able to read the voltage value).

Related links

Closes #11177

@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 Apr 1, 2025
@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this Apr 1, 2025
Copy link
Contributor

github-actions bot commented Apr 1, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Update libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino":
    • summary looks empty
    • type/action looks empty
  • the commit message "Update libraries/Zigbee/src/ZigbeeEP.cpp":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 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.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- 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 6eed3db

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32S30⚠️ +280.000.00000.000.00
ESP32S20⚠️ +280.000.00000.000.00
ESP32C3000.000.00000.000.00
ESP32C60⚠️ +240.000.00000.000.00
ESP32H20⚠️ +220.000.00000.000.00
ESP320⚠️ +280.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch⚠️ +280⚠️ +280000000⚠️ +280
libraries/Zigbee/examples/Zigbee_Gateway⚠️ +280⚠️ +28000----⚠️ +280
libraries/Zigbee/examples/Zigbee_On_Off_Switch⚠️ +280⚠️ +280000000⚠️ +280
libraries/Zigbee/examples/Zigbee_Range_Extender⚠️ +280⚠️ +280000000⚠️ +280
libraries/Zigbee/examples/Zigbee_Thermostat⚠️ +280⚠️ +280000000⚠️ +280
libraries/Zigbee/examples/Zigbee_Analog_Input_Output------0000--
libraries/Zigbee/examples/Zigbee_CarbonDioxide_Sensor------0000--
libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light------0000--
libraries/Zigbee/examples/Zigbee_Contact_Switch------0000--
libraries/Zigbee/examples/Zigbee_Dimmable_Light------0000--
libraries/Zigbee/examples/Zigbee_Illuminance_Sensor------⚠️ +240⚠️ +220--
libraries/Zigbee/examples/Zigbee_OTA_Client------0000--
libraries/Zigbee/examples/Zigbee_Occupancy_Sensor------0000--
libraries/Zigbee/examples/Zigbee_On_Off_Light------0000--
libraries/Zigbee/examples/Zigbee_PM25_Sensor------0000--
libraries/Zigbee/examples/Zigbee_Pressure_Flow_Sensor------0000--
libraries/Zigbee/examples/Zigbee_Scan_Networks------0000--
libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy------⚠️ +180⚠️ +180--
libraries/Zigbee/examples/Zigbee_Temperature_Sensor------0000--
libraries/Zigbee/examples/Zigbee_Vibration_Sensor------0000--
libraries/Zigbee/examples/Zigbee_Wind_Speed_Sensor------0000--
libraries/Zigbee/examples/Zigbee_Window_Covering------0000--

Copy link
Contributor

github-actions bot commented Apr 1, 2025

Test Results

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

Results for commit 6eed3db.

♻️ This comment has been updated with latest results.

@me-no-dev me-no-dev requested a review from Copilot April 3, 2025 12:14
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 battery voltage attribute support to the Zigbee Power Config Cluster by updating method signatures and implementations to accept battery voltage along with battery percentage.

  • Updated ZigbeeEP.h to introduce a new parameter and method for battery voltage.
  • Modified ZigbeeEP.cpp to update the setPowerSource method and implement setBatteryVoltage with corresponding error handling.
  • Adjusted the Sleepy example to include the battery voltage parameter in the demonstration.

Reviewed Changes

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

File Description
libraries/Zigbee/src/ZigbeeEP.h Added battery voltage parameter to setPowerSource and a new setBatteryVoltage method.
libraries/Zigbee/src/ZigbeeEP.cpp Adjusted method signature for setPowerSource and implemented setBatteryVoltage; contains an incorrect error message for battery voltage.
libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino Updated the example to use the new method signature with battery voltage.

Copy link
Collaborator

@SuGlider SuGlider left a comment

Choose a reason for hiding this comment

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

LGTM

@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Apr 7, 2025
@me-no-dev me-no-dev merged commit d3509ef into espressif:master Apr 9, 2025
56 checks passed
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: Pending Merge Pull Request is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the Battery Voltage Cluster to Battery powered Zigbee End Points
3 participants