Subscribe to Child Device Attributes
Type of Change
- [ ] WWST Certification Request
- If this is your first time contributing code:
- [ ] I have reviewed the README.md file
- [ ] I have reviewed the CODE_OF_CONDUCT.md file
- [ ] I have signed the CLA
- [ ] I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
- If this is your first time contributing code:
- [ ] Bug fix
- [X] New feature
- [ ] Refactor
Checklist
- [X] I have performed a self-review of my code
- [ ] I have commented my code in hard-to-understand areas
- [X] I have verified my changes by testing with a device or have communicated a plan for testing
- [X] I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior
Description of Change
This change adds support for subscribing to the attributes of child devices.
Summary of Completed Tests
Invitation URL: https://bestow-regional.api.smartthings.com/invite/gV2qar4VQ929
Test Results
61 files 379 suites 0s :stopwatch: 1 855 tests 1 855 :white_check_mark: 0 :zzz: 0 :x: 3 211 runs 3 211 :white_check_mark: 0 :zzz: 0 :x:
Results for commit 7d1fb626.
:recycle: This comment has been updated with latest results.
| File | Coverage | |
|---|---|---|
| All files | 95% |
:white_check_mark: |
| /home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua | 96% |
:white_check_mark: |
| /home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua | 91% |
:white_check_mark: |
Minimum allowed coverage is 90%
Generated by :monkey: cobertura-action against 7d1fb626f6bdfac3ee7d9a515f5be4f164da18a1
I'm a little confused to the functionality being added here. So the title states "subscribe to child device attributes", but this subscription logic is being added in init, not where the child profiles are being created in initialize_switch. @nickolas-deboom would you mind explaining the control flow of this logic? Thank you
I'm a little confused to the functionality being added here. So the title states "subscribe to child device attributes", but this subscription logic is being added in init, not where the child profiles are being created in initialize_switch. @nickolas-deboom would you mind explaining the control flow of this logic? Thank you
When the child devices are created, init will be ran for each instance and at that point the subscriptions to the attributes for the child devices will occur. This needs to take place in init so that the attributes are re-subscribed to for each re-initialization of the device.
LGTM! I left just one nit to be fixed before merging. Also could you fill out the summary of completed tests section of the PR comment template? Then I think it should be good to go!
Fixed the nit and added some info in the test section!