Skip to content

Matter Appliance minor refactor #2181

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nickolas-deboom
Copy link
Contributor

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

This change moves some common functionality into common-utils.lua, implements do_configure in the subdrivers rather than the main driver, and also contains some minor fixes involving embedded clusters.

Summary of Completed Tests

This change moves some common functionality into common-utils.lua,
implements do_configure in the subdrivers rather than the main driver,
and also contains some minor fixes involving embedded clusters.
Copy link

github-actions bot commented Jun 9, 2025

Copy link

github-actions bot commented Jun 9, 2025

Test Results

   67 files  ±0    442 suites  +1   0s ⏱️ ±0s
2 260 tests ±0  2 260 ✅ ±0  0 💤 ±0  0 ❌ ±0 
3 857 runs  ±0  3 857 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit de08bae. ± Comparison against base commit e87aaec.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 9, 2025

File Coverage
All files 78%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-cook-top/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-dishwasher/init.lua 70%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/common-utils.lua 81%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-refrigerator/init.lua 84%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-microwave-oven/init.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/embedded-cluster-utils.lua 49%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-extractor-hood/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/init.lua 70%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-oven/init.lua 85%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-appliance/src/matter-laundry/init.lua 70%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against de08bae

Copy link
Contributor

@hcarter-775 hcarter-775 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job. seems very necessary 👍

increase test coverage, test doConfigure setpoint limit reads, and move
laundry washer test cases to a new test file
The attribute and capability handlers related to temperature are common
across the subdrivers that use them and can be moved into the main
driver. A few helper functions were moved into the common module so that
they can be used by the main driver and sub drivers.
@nickolas-deboom nickolas-deboom force-pushed the matter-appliance-minor-subdriver-refactor branch from c7d7de2 to 800f694 Compare June 9, 2025 21:26
@nickolas-deboom
Copy link
Contributor Author

I made an update to move some of the temperature attribute and capability handlers into the main driver and remove them from the subdrivers because these have the same behavior in all cases. I left temperature_setpoint_attr_handler and setpoint_limit_handler defined in the subdrivers because difference min and max values are used in these handlers depending on the device type.

Use `check_field_name_updates`, previously implemented in matter-switch,
to update "__supported_temperature_levels", previously used in
matter-laundry and matter-dishwasher, to
"__supported_temperature_levels_map", which is now used in every
subdriver.
@@ -0,0 +1,187 @@
-- Copyright 2024 SmartThings
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved these test cases into their own file in order to properly test the doConfigure logic in test_init

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