Skip to content

Conversation

@Oniums
Copy link

@Oniums Oniums commented Oct 30, 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

This PR adds support for the Sonoff SNZB-01M Smart Scene Button to the existing zigbee-button driver.

Changes made:

  1. Added device fingerprint in fingerprints.yml to recognize the SONOFF SNZB-01M device
  2. Created device profile sonoff-buttons-battery.yml with 4 button components and battery capability
  3. Implemented custom handler in src/zigbee-multi-button/sonoff/init.lua to handle SONOFF-specific Zigbee communication
  4. Added device support to the multi-button matching matrix with support for 4 button actions: pushed, double, held, pushed_3x
  5. Created test file test_sonoff_button.lua for verification purposes

Summary of Completed Tests

Device Testing:

  • Device pairing: Successfully paired SONOFF SNZB-01M with SmartThings Hub
  • Button actions: Verified all 4 button types work correctly:
    • Single press (pushed)
    • Double press (double)
    • Long press (held)
    • Triple press (pushed_3x)
  • Battery reporting: Confirmed battery percentage is correctly displayed in SmartThings app
  • Endpoint mapping: Verified button events are properly mapped to correct button components (button1-button4)

Code Testing:

  • Fingerprint recognition: Device correctly identified during pairing process
  • Profile loading: Device profile loaded successfully with all 4 button components
  • Event handling: Custom SONOFF handler processes Zigbee messages correctly
  • Integration: No conflicts with existing button drivers

Compatibility:

  • SmartThings Hub compatibility: Tested on SmartThings Hub v3
  • Driver integration: Successfully integrates with existing zigbee-button driver framework
  • No regression: Existing button devices continue to function normally

@@ -0,0 +1,87 @@
-- Copyright 2024 SmartThings

Choose a reason for hiding this comment

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

Update date

@@ -0,0 +1,26 @@
-- Test file for SONOFF SNZB-01M integration

Choose a reason for hiding this comment

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

Please add copyright info.

end
end

return test No newline at end of file

Choose a reason for hiding this comment

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

Please add some proper unit tests utiliizing expect_send and expect_receive. More details can be found here

@github-actions
Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link

@github-actions
Copy link

Test Results

   71 files    478 suites   0s ⏱️
2 471 tests 2 471 ✅ 0 💤 0 ❌
4 236 runs  4 236 ✅ 0 💤 0 ❌

Results for commit e9d7cbf.

@github-actions
Copy link

File Coverage
All files 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/vimar/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/frient/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/ecosmart/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/somfy/somfy_situo_4.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/ikea/TRADFRI_remote_control.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/ikea/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/adurosmart/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/supported_values.lua 99%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/iris/init.lua 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/zunzunbee/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/aqara/init.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/wallhero/init.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/button_utils.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/robb/init.lua 99%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/pushButton/init.lua 76%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/heiman/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/SLED/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/shinasystems/init.lua 98%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against e9d7cbf

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