-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat(matter): adds HoldTime attribute to the Matter Occupancy endpoint #12146
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
Conversation
👋 Hello SuGlider, 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 ...
Review and merge process you can expect ...
|
Test Results 90 files 90 suites 29m 36s ⏱️ For more details on these failures, see this check. Results for commit 791d3a5. ♻️ This comment has been updated with latest results. |
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.
Click to expand the detailed deltas report [usage change in BYTES]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
My test with HA worked too. |
pedrominatel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @SuGlider. I wish all the README's be like this!
There was a problem hiding this 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 HoldTime and HoldTimeLimits attributes to the Matter Occupancy Sensor endpoint, allowing control over how long the sensor maintains an "occupied" state after detection. The implementation includes a callback mechanism for Matter Controller updates and demonstrates HoldTime expiration logic in a comprehensive example.
Key changes:
- Added HoldTime attribute support with getter/setter methods and validation against configurable limits
- Implemented custom AttributeAccessInterface wrapper to intercept HoldTime writes and trigger user callbacks
- Added complete example demonstrating HoldTime functionality with persistence across reboots using Preferences
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| libraries/Matter/src/MatterEndpoints/MatterOccupancySensor.h | Adds HoldTime/HoldTimeLimits API methods, callback typedef, private member variables, and friend class declaration |
| libraries/Matter/src/MatterEndpoints/MatterOccupancySensor.cpp | Implements HoldTime functionality with attribute creation, validation, event loop scheduling, and custom AttributeAccessInterface wrapper |
| libraries/Matter/keywords.txt | Adds keywords for new types and methods (OccupancySensorType_t, HoldTimeChangeCB, setHoldTime, getHoldTime, setHoldTimeLimits, onHoldTimeChange, sensor type literals) |
| libraries/Matter/examples/MatterOccupancyWithHoldTime/ci.yml | Configures CI with huge_app partition scheme and Matter data model requirement |
| libraries/Matter/examples/MatterOccupancyWithHoldTime/README.md | Comprehensive documentation covering features, setup, HoldTime behavior, PIR sensor integration, and troubleshooting |
| libraries/Matter/examples/MatterOccupancyWithHoldTime/MatterOccupancyWithHoldTime.ino | Complete example with simulated occupancy sensor, HoldTime persistence, callback handling, and commissioning flow |
| docs/en/matter/ep_occupancy_sensor.rst | Documents new HoldTime API methods with examples and usage guidance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
libraries/Matter/examples/MatterOccupancyWithHoldTime/MatterOccupancyWithHoldTime.ino
Outdated
Show resolved
Hide resolved
libraries/Matter/examples/MatterOccupancyWithHoldTime/MatterOccupancyWithHoldTime.ino
Outdated
Show resolved
Hide resolved
libraries/Matter/examples/MatterOccupancyWithHoldTime/MatterOccupancyWithHoldTime.ino
Outdated
Show resolved
Hide resolved
|
@me-no-dev - All set. Ready for merging. |
Description of Change
This PR adds HoldTime and HoldTimeLimits attributes to Arduino Matter Occupancy Sensor endpoint.
It also adds a user callback for the device get notified that the Matter Controller has changed such parameter.
It is possible for the device to change both HoldTime and HoldTimeLimits using the Arduino Matter API.
Test Scenarios
Tested using Home Assistant with WiFi using the ESP32-C6.
The test uses the provided example.
Related links
Closes #12135