Add Sonoff SNZB-04PR2 and SNZB-04P Smart Scene Contact into zigbee-contact #2539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check all that apply
Type of Change
Checklist
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