Skip to content

Conversation

Cornelius117
Copy link
Contributor

@Cornelius117 Cornelius117 commented Sep 23, 2025

Check all that apply

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

In the past, the button devices with motion sensor did not support their complete functions. Now add relevant processing logic, so that this kind of devices can display the sensor normally in the plugin.

Summary of Completed Tests

The unit test file is contained in the commit, and all tests can pass.

Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

Copy link

Copy link

github-actions bot commented Sep 23, 2025

Test Results

   71 files  + 1    453 suites  +2   0s ⏱️ ±0s
2 351 tests + 7  2 351 ✅ + 7  0 💤 ±0  0 ❌ ±0 
3 979 runs  +30  3 979 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit ac5ed1b. ± Comparison against base commit 754f2a7.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Sep 23, 2025

File Coverage
All files 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua 92%
/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/aqara-cube/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/third-reality-mk1/init.lua 95%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against ac5ed1b

capabilities:
- id: motionSensor
version: 1
- id: firmwareUpdate
Copy link
Contributor

Choose a reason for hiding this comment

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

firmwareUpdate and refresh can be removed from the motion component here, since they are already in the main component.

Comment on lines 47 to 50
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here.

build_button_profile(device, main_endpoint, #button_eps, #motion_eps)
-- All button endpoints found will be added as additional components in the profile containing the main_endpoint.
-- The resulting endpoint to component map is saved in the COMPONENT_TO_ENDPOINT_MAP field
build_button_component_map(device, main_endpoint, button_eps)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
build_button_component_map(device, main_endpoint, button_eps)
build_button_component_map(device, main_endpoint, button_eps, motion_eps)

We could pass in the motion endpoints here just like you did for build_button_profile, and then add the motion endpoint to the component-endpoint map within build_button_component_map rather than introduce a new build_motion_component_map function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you for your kind advice! We have revised the places you mentioned, please check whether there is still room for improvement.

@nickolas-deboom
Copy link
Contributor

nickolas-deboom commented Sep 23, 2025

I left a few comments but overall the proposed changes look fine to me, and thank you for providing unit tests. Have you tested this change on the device and confirmed that the plugin renders correctly?

@Cornelius117
Copy link
Contributor Author

I left a few comments but overall the proposed changes look fine to me, and thank you for providing unit tests. Have you tested this change on the device and confirmed that the plugin renders correctly?

Yes, we have tested these changes on the device, and the display on the plugin is as expected.

- name: RemoteController
- id: motion
capabilities:
- id: motionSensor
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I'm wondering why we're putting motion on its own component in the first place? Seems like this should be in the main component. Same for the other

Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify, our current process is to put all capabilities that don't require special handling to be placed on the main component. Doing this will make the changes in the component map moot, and the event should be emitted on main by default. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, that's a good callout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have tried this modification before, but the results are somewhat different from what we expected. We put the details in the comments on this page (https://smartthings.atlassian.net/browse/MTR-939). Please review.

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.

3 participants