Skip to content

Conversation

@laity-w-sudo
Copy link

@laity-w-sudo laity-w-sudo commented Nov 7, 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 Sonoff SNZB-04PR2 Smart Scene Contact into zigbee-contact,In fact, it also includes SNZB-04P. The two devices have exactly the same functions, so they are submitted together.

Changes made:
1.Added device fingerprint in fingerprints.yml to recognize the SONOFF SNZB-04PR2 and SNZB-04P device
2.Implemented custom handler in src/sonoff/init.lua to handle SONOFF-specific Zigbee communication
3.Implemented custom handler in src/sonoff/SNZB-04PR2/init.lua to handle SONOFF-specific Zigbee communication
4.Added the detection and reporting function for the device's door magnetic status and tamper prevention status.
5.Add contact-battery-tamper.yml into profiles.

Summary of Completed Tests

Device Testing:
✅ Device pairing: Successfully paired SONOFF SNZB-04PR2 and SNZB-04P with SmartThings Hub
✅ Status reporting actions: Verified both types of status work correctly:
Door magnetic sensor status reporting
Alarm removal status reporting
✅ Battery reporting: Confirmed battery percentage is correctly displayed in SmartThings app
✅ Endpoint mapping: Verified button events are properly mapped to correct contact components
Code Testing:
✅ Fingerprint recognition: Device correctly identified during pairing process
✅ Profile loading: Device profile loaded successfully
✅ 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

@CLAassistant
Copy link

CLAassistant commented Nov 7, 2025

CLA assistant check
All committers have signed the CLA.

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