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

Override child profiles for lights and plugs only #1874

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickolas-deboom
Copy link
Contributor

@nickolas-deboom nickolas-deboom commented Jan 15, 2025

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
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • 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

Devices that utilize the child_device_profile_overrides table may contain other endpoints that should not have their profile overridden when the child device is created. This PR ensures that the profile is only overridden for light and plug child device types. See the discussion from PR 1872.

Note that GENERIC_SWITCH_ID was removed from device_type_profile_map. This is because it is never used in this table and also to make it clear that device types in this table may have their child device profile overridden (buttons do not use parent-child).

Summary of Completed Tests

Copy link

Copy link

github-actions bot commented Jan 15, 2025

Test Results

   64 files    406 suites   0s ⏱️
2 013 tests 2 013 ✅ 0 💤 0 ❌
3 489 runs  3 489 ✅ 0 💤 0 ❌

Results for commit 56da529.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jan 15, 2025

File Coverage
All files 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/embedded-cluster-utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/aqara-cube/init.lua 96%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 56da529

@hcarter-775
Copy link
Contributor

can we make a unit test or two for this? seems like a worthwhile thing to make sure it doesn't break

@nickolas-deboom nickolas-deboom force-pushed the override-child-profiles-for-lights-and-plugs-only branch from ff83f6a to 17e146a Compare January 15, 2025 19:17
@nickolas-deboom
Copy link
Contributor Author

can we make a unit test or two for this? seems like a worthwhile thing to make sure it doesn't break

Yeah good call - I updated a mock device in test_multi_switch_parent_child_lights.lua to use an overridden profile for one of its child devices. Also note that I made a mistake in the initial commit, now it only overrides the profile if the profile is going to be "plug-binary", rather than any profile in device_type_profile_map. This is the only situation that we'd want to do this at this point.

@nickolas-deboom nickolas-deboom force-pushed the override-child-profiles-for-lights-and-plugs-only branch from 17e146a to 4e98553 Compare January 15, 2025 19:21
Devices that utilize the child_device_profile_overrides table may
contain other endpoints that should not have their profile overridden
when the child device is created.
@nickolas-deboom nickolas-deboom force-pushed the override-child-profiles-for-lights-and-plugs-only branch from 4e98553 to 56da529 Compare January 28, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants