Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(zigbee): Add option to set initial (default) value#12147

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
me-no-dev merged 4 commits intomasterfromfeat/zibee-sensor-default-value
Dec 18, 2025

Conversation

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

Description of Change

This pull request introduces support for setting default (initial) measurement values for various Zigbee sensor endpoint classes, ensuring that sensors start with a defined value after a factory reset and before receiving actual readings. The changes include newsetDefaultValue methods for several sensor types, updates to documentation, and adjustments to example usage to demonstrate the new functionality.

Core feature: Default value support for Zigbee sensors

  • AddedsetDefaultValue methods to the following sensor classes, allowing users to set an initial measurement value to be used after a factory reset and before the sensor reports real data:
    • ZigbeeTempSensor,ZigbeeCarbonDioxideSensor,ZigbeeFlowSensor,ZigbeeIlluminanceSensor,ZigbeePM25Sensor,ZigbeePressureSensor, andZigbeeWindSpeedSensor (libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp,ZigbeeCarbonDioxideSensor.cpp,ZigbeeFlowSensor.cpp,ZigbeeIlluminanceSensor.cpp,ZigbeePM25Sensor.cpp,ZigbeePressureSensor.cpp,ZigbeeWindSpeedSensor.cpp; corresponding.h files)[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18]

Documentation updates

  • Updated documentation for all affected sensor endpoint types to describe the newsetDefaultValue method, its usage, and its effect during factory reset (before commissioning or joining a network) (docs/en/zigbee/ep_temperature_sensor.rst,ep_carbon_dioxide_sensor.rst,ep_flow_sensor.rst,ep_illuminance_sensor.rst,ep_pm25_sensor.rst,ep_pressure_sensor.rst,ep_wind_speed_sensor.rst)[1][2][3][4][5][6][7]

Example usage improvements

  • Updated example sketches to demonstrate setting a default value for temperature and humidity sensors, including changes to theaddHumiditySensor method to accept a default value parameter (libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino,Zigbee_Temperature_Sensor.ino,ZigbeeTempSensor.cpp)[1][2][3]

These changes make it easier to ensure predictable sensor behavior after a factory reset and improve the clarity and usability of the sensor API.

Test Scenarios

Tested using the Temperature sensor example and HomeAssitant (ZHA)

Related links

Closes#12041

@P-R-O-C-H-YP-R-O-C-H-Y self-assigned thisDec 17, 2025
@P-R-O-C-H-YP-R-O-C-H-Y added Status: Review neededIssue or PR is awaiting review Area: ZigbeeIssues and Feature Request about Zigbee labelsDec 17, 2025
@github-actions
Copy link
Contributor

github-actionsbot commentedDec 17, 2025
edited
Loading

Messages
📖🎉 Good Job! All checks are passing!

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


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

🖊️ Please also make sure you haveread and signed theContributor License Agreement for this project.

Click to see more instructions ...


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

DangerJS is triggered with eachpush 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 isnot a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manuallyretry these Danger checks, please navigate to theActions 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 againsta510d79

Copy link
Contributor

CopilotAI 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 pull request adds support for setting default (initial) measurement values for Zigbee sensor endpoints, ensuring predictable behavior after factory reset and before sensors receive actual readings. The implementation extends seven sensor classes with newsetDefaultValue methods, updates documentation, and modifies example code to demonstrate the feature.

Key changes:

  • AddedsetDefaultValue methods to seven sensor classes (Temperature, CO2, Flow, Illuminance, PM2.5, Pressure, and Wind Speed)
  • UpdatedaddHumiditySensor method to accept a default value parameter with backward-compatible default arguments
  • Enhanced documentation with comprehensive descriptions of the new functionality

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
libraries/Zigbee/src/ep/ZigbeeTempSensor.hAdded setDefaultValue method declaration for temperature sensor
libraries/Zigbee/src/ep/ZigbeeTempSensor.cppImplemented setDefaultValue with proper int16_t conversion; added default value to addHumiditySensor signature; constructor now calls setDefaultValue(0.0)
libraries/Zigbee/src/ep/ZigbeeWindSpeedSensor.hAdded setDefaultValue method declaration for wind speed sensor
libraries/Zigbee/src/ep/ZigbeeWindSpeedSensor.cppImplemented setDefaultValue with uint16_t conversion
libraries/Zigbee/src/ep/ZigbeeFlowSensor.hAdded setDefaultValue method declaration for flow sensor
libraries/Zigbee/src/ep/ZigbeeFlowSensor.cppImplemented setDefaultValue with uint16_t conversion
libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.hAdded setDefaultValue method declaration for illuminance sensor
libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.cppImplemented setDefaultValue for uint16_t values
libraries/Zigbee/src/ep/ZigbeePM25Sensor.hAdded setDefaultValue method declaration for PM2.5 sensor
libraries/Zigbee/src/ep/ZigbeePM25Sensor.cppImplemented setDefaultValue using float type directly
libraries/Zigbee/src/ep/ZigbeePressureSensor.hAdded setDefaultValue method declaration for pressure sensor
libraries/Zigbee/src/ep/ZigbeePressureSensor.cppImplemented setDefaultValue for int16_t values
libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.hAdded setDefaultValue method declaration for CO2 sensor
libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cppImplemented setDefaultValue with float conversion (divide by 1,000,000)
libraries/Zigbee/examples/Zigbee_Temperature_Sensor/Zigbee_Temperature_Sensor.inoAdded example call to setDefaultValue(10.0)
libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.inoUpdated to demonstrate setDefaultValue for temperature and updated addHumiditySensor call with default value parameter
docs/en/zigbee/ep_temperature_sensor.rstAdded documentation for setDefaultValue method
docs/en/zigbee/ep_wind_speed_sensor.rstAdded documentation for setDefaultValue method
docs/en/zigbee/ep_pressure_sensor.rstAdded documentation for setDefaultValue method
docs/en/zigbee/ep_pm25_sensor.rstAdded documentation for setDefaultValue method
docs/en/zigbee/ep_illuminance_sensor.rstAdded documentation for setDefaultValue method
docs/en/zigbee/ep_flow_sensor.rstAdded documentation for setDefaultValue method
docs/en/zigbee/ep_carbon_dioxide_sensor.rstAdded documentation for setDefaultValue method

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

@github-actions
Copy link
Contributor

github-actionsbot commentedDec 17, 2025
edited
Loading

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
ESP32C5000.000.00000.000.00
ESP32S3000.000.00000.000.00
ESP32S20⚠️ +1960.00⚠️ +0.03000.000.00
ESP32C3000.000.00000.000.00
ESP32C6000.000.00000.000.00
ESP32H20⚠️ +1680.00⚠️ +0.03000.000.00
ESP320⚠️ +2000.00⚠️ +0.03000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/Zigbee/examples/Zigbee_Analog_Input_Output----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_Binary_Input_Output----------00--
libraries/Zigbee/examples/Zigbee_CarbonDioxide_Sensor----------00--
libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light----------00--
libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_Contact_Switch----------00--
libraries/Zigbee/examples/Zigbee_Dimmable_Light----------00--
libraries/Zigbee/examples/Zigbee_Electrical_AC_Sensor----⚠️ +196000--00⚠️ +2000
libraries/Zigbee/examples/Zigbee_Electrical_AC_Sensor_MultiPhase----⚠️ +196000--00⚠️ +2000
libraries/Zigbee/examples/Zigbee_Electrical_DC_Sensor----------00--
libraries/Zigbee/examples/Zigbee_Fan_Control----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_Gateway----⚠️ +196000----⚠️ +1960
libraries/Zigbee/examples/Zigbee_Illuminance_Sensor----------00--
libraries/Zigbee/examples/Zigbee_Multistate_Input_Output----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_OTA_Client----------00--
libraries/Zigbee/examples/Zigbee_Occupancy_Sensor----------00--
libraries/Zigbee/examples/Zigbee_On_Off_Light----------00--
libraries/Zigbee/examples/Zigbee_On_Off_MultiSwitch----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_On_Off_Switch----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_PM25_Sensor----------00--
libraries/Zigbee/examples/Zigbee_Power_Outlet----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_Pressure_Flow_Sensor----------00--
libraries/Zigbee/examples/Zigbee_Range_Extender----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_Scan_Networks----------00--
libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy----------⚠️ +1680--
libraries/Zigbee/examples/Zigbee_Temperature_Sensor----------⚠️ +1340--
libraries/Zigbee/examples/Zigbee_Thermostat----⚠️ +196000--00⚠️ +1960
libraries/Zigbee/examples/Zigbee_Vibration_Sensor----------00--
libraries/Zigbee/examples/Zigbee_Wind_Speed_Sensor----------00--

@github-actions
Copy link
Contributor

github-actionsbot commentedDec 17, 2025
edited
Loading

Test Results

 90 files   90 suites   32m 5s ⏱️
 66 tests  66 ✅ 0 💤 0 ❌
675 runs  675 ✅ 0 💤 0 ❌

Results for commita510d79.

♻️ This comment has been updated with latest results.

@me-no-devme-no-dev added Status: Pending MergePull Request is ready to be merged and removed Status: Review neededIssue or PR is awaiting review labelsDec 18, 2025
@me-no-devme-no-dev merged commitc6b7dca intomasterDec 18, 2025
80 checks passed
@me-no-devme-no-dev deleted the feat/zibee-sensor-default-value branchDecember 18, 2025 15:59
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@pedrominatelpedrominatelpedrominatel approved these changes

@me-no-devme-no-devme-no-dev approved these changes

@lucasssvazlucasssvazlucasssvaz approved these changes

Assignees

@P-R-O-C-H-YP-R-O-C-H-Y

Labels

Area: ZigbeeIssues and Feature Request about ZigbeeStatus: Pending MergePull Request is ready to be merged

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Temperature and humidity sensor has garbage after starting ESP32C6

5 participants

@P-R-O-C-H-Y@pedrominatel@me-no-dev@lucasssvaz

[8]ページ先頭

©2009-2025 Movatter.jp