SmartThingsCommunity / SmartThingsEdgeDrivers

Apache License 2.0
259 stars 446 forks source link

Subscribe to Child Device Attributes #1548

Closed nickolas-deboom closed 5 days ago

nickolas-deboom commented 1 month ago

Type of Change

Checklist

Description of Change

https://smartthings.atlassian.net/browse/CHAD-13271

This change adds support for subscribing to the attributes of child devices.

Summary of Completed Tests

New unit tests were created to verify these changes. Also, it was tested with a VDA virtual switch to ensure all functionality worked as expected and that there were not any unintended effects.

github-actions[bot] commented 1 month ago

Invitation URL: https://bestow-regional.api.smartthings.com/invite/gV2qar4VQ929

github-actions[bot] commented 1 month ago

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.

github-actions[bot] commented 1 month ago

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

hcarter-775 commented 1 week ago

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

nickolas-deboom commented 1 week ago

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.

nickolas-deboom commented 5 days ago

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!