WWSTCERT-10701 Add Sonoff SNZB-01M Smart Scene Button into zigbee-button.#2510
WWSTCERT-10701 Add Sonoff SNZB-01M Smart Scene Button into zigbee-button.#2510Oniums wants to merge 9 commits intoSmartThingsCommunity:mainfrom
Conversation
drivers/SmartThings/zigbee-button/src/zigbee-multi-button/sonoff/init.lua
Outdated
Show resolved
Hide resolved
drivers/SmartThings/zigbee-button/src/test/test_sonoff_button.lua
Outdated
Show resolved
Hide resolved
drivers/SmartThings/zigbee-button/src/test/test_sonoff_button.lua
Outdated
Show resolved
Hide resolved
|
Duplicate profile check: Passed - no duplicate profiles detected. |
|
Invitation URL: |
Test Results 72 files 496 suites 0s ⏱️ For more details on these errors, see this check. Results for commit d487ce0. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against d487ce0 |
drivers/SmartThings/zigbee-button/src/test/test_sonoff_button.lua
Outdated
Show resolved
Hide resolved
drivers/SmartThings/zigbee-button/src/zigbee-multi-button/sonoff/init.lua
Outdated
Show resolved
Hide resolved
drivers/SmartThings/zigbee-button/src/zigbee-multi-button/sonoff/init.lua
Outdated
Show resolved
Hide resolved
|
drivers/SmartThings/zigbee-button/src/zigbee-multi-button/sonoff/init.lua
Outdated
Show resolved
Hide resolved
| }, | ||
| SONOFF_BUTTON_4 = { | ||
| MATCHING_MATRIX = { | ||
| { mfr = "SONOFF", model = "SNZB-01M" } | ||
| }, | ||
| SUPPORTED_BUTTON_VALUES = { "pushed", "double", "held", "pushed_3x" }, | ||
| NUMBER_OF_BUTTONS = 4 |
There was a problem hiding this comment.
Since you overwrote added in your handler (because you did not include the button capability on your main component, this info is never used.
There was a problem hiding this comment.
Thanks for the suggestion. I checked the existing profiles: four-buttons-without-main-button has no battery capability, while four-buttons-battery includes button on main, which doesn’t match the SNZB-01M capability layout. Would you prefer that I: use four-buttons-without-main-button and accept no battery on main, or use the profile I added earlier.
There was a problem hiding this comment.
I understand why you've added the new profile, but I'll advise you on why our multi-button profiles include the button capability on the main component: without it (and duplicating any other buttons' events to main, the remote on the device list will not change to indicate button presses. You'll only see them within the device details page.
I didn't notice four-buttons-without-main-button didn't have battery. I definitely think you should maintain that.
So you can go with your new profile if you like, but this comment was merely pointing out that, because these values are only used in the zigbee-multi-button added handler, your additions to this file are not used.
There was a problem hiding this comment.
I'll advise you on why our multi-button profiles include the button capability on the main component: without it (and duplicating any other buttons' events to main, the remote on the device list will not change to indicate button presses. You'll only see them within the device details page.
It seems that you are going to go forward with the profile as is. I am commenting to make sure you have tested the device on the platform to ensure it works the way you want, since this is different than what we have for our multibutton profiles. We recommend having the button capability on the main component, and duplicating events for any button press to that component also, so that in the device list view of the app, you can see the events affect the device rather than in just the details view. Doing so also gives users a hook for routines that will trigger on any button press of the remote.
|
drivers/SmartThings/zigbee-button/src/zigbee-multi-button/sonoff/init.lua
Outdated
Show resolved
Hide resolved
|
driver needs to be rebased |
|
Is the rebase based on this PR? If I submit a new PR, will it cause any issues if it doesn’t match the PR used for the Samsung certification application? |
|
@Oniums you should be able to set your fork's upstream to our main repo, update the main branch there, then rebase your changes on your local branch onto In your fork's directory: Then you should be able to resolve the conflicts and |
… lines Update copyright year from 2022 to 2026,remove remove whitespace-only lines
remove log.info
- Remove custom battery attribute handler and added lifecycle in Sonoff subdriver - Align Sonoff tests with default added behavior and keep battery report coverage
drivers/SmartThings/zigbee-button/src/test/test_sonoff_button.lua
Outdated
Show resolved
Hide resolved
KKlimczukS
left a comment
There was a problem hiding this comment.
Please update copyright sections
| -- Copyright 2026 SmartThings | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 (the "License"); | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and | ||
| -- limitations under the License. |
There was a problem hiding this comment.
| -- Copyright 2026 SmartThings | |
| -- | |
| -- Licensed under the Apache License, Version 2.0 (the "License"); | |
| -- you may not use this file except in compliance with the License. | |
| -- You may obtain a copy of the License at | |
| -- | |
| -- http://www.apache.org/licenses/LICENSE-2.0 | |
| -- | |
| -- Unless required by applicable law or agreed to in writing, software | |
| -- distributed under the License is distributed on an "AS IS" BASIS, | |
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| -- See the License for the specific language governing permissions and | |
| -- limitations under the License. | |
| -- Copyright 2026 SmartThings, Inc. | |
| -- Licensed under the Apache License, Version 2.0 |
| -- Copyright 2026 SmartThings | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 (the "License"); | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and |
There was a problem hiding this comment.
| -- Copyright 2026 SmartThings | |
| -- | |
| -- Licensed under the Apache License, Version 2.0 (the "License"); | |
| -- you may not use this file except in compliance with the License. | |
| -- You may obtain a copy of the License at | |
| -- | |
| -- http://www.apache.org/licenses/LICENSE-2.0 | |
| -- | |
| -- Unless required by applicable law or agreed to in writing, software | |
| -- distributed under the License is distributed on an "AS IS" BASIS, | |
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| -- See the License for the specific language governing permissions and | |
| -- Copyright 2026 SmartThings, Inc. | |
| -- Licensed under the Apache License, Version 2.0 |
| -- Copyright 2026 SmartThings | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 (the "License"); | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and | ||
| -- limitations under the License. |
There was a problem hiding this comment.
| -- Copyright 2026 SmartThings | |
| -- | |
| -- Licensed under the Apache License, Version 2.0 (the "License"); | |
| -- you may not use this file except in compliance with the License. | |
| -- You may obtain a copy of the License at | |
| -- | |
| -- http://www.apache.org/licenses/LICENSE-2.0 | |
| -- | |
| -- Unless required by applicable law or agreed to in writing, software | |
| -- distributed under the License is distributed on an "AS IS" BASIS, | |
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| -- See the License for the specific language governing permissions and | |
| -- limitations under the License. | |
| -- Copyright 2026 SmartThings, Inc. | |
| -- Licensed under the Apache License, Version 2.0 |
| -- Copyright 2026 SmartThings | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 (the "License"); | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and | ||
| -- limitations under the License. |
There was a problem hiding this comment.
| -- Copyright 2026 SmartThings | |
| -- | |
| -- Licensed under the Apache License, Version 2.0 (the "License"); | |
| -- you may not use this file except in compliance with the License. | |
| -- You may obtain a copy of the License at | |
| -- | |
| -- http://www.apache.org/licenses/LICENSE-2.0 | |
| -- | |
| -- Unless required by applicable law or agreed to in writing, software | |
| -- distributed under the License is distributed on an "AS IS" BASIS, | |
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| -- See the License for the specific language governing permissions and | |
| -- limitations under the License. | |
| -- Copyright 2026 SmartThings, Inc. | |
| -- Licensed under the Apache License, Version 2.0 |
cjswedes
left a comment
There was a problem hiding this comment.
LGTM, just note the suggestion to reconsider adding the button capability to the main component of the device and emitting events for it when any button is affected.
| return false | ||
| end | ||
|
|
||
| return sonoff_can_handle No newline at end of file |
There was a problem hiding this comment.
nit: newline in this file and all the other files.
| }, | ||
| SONOFF_BUTTON_4 = { | ||
| MATCHING_MATRIX = { | ||
| { mfr = "SONOFF", model = "SNZB-01M" } | ||
| }, | ||
| SUPPORTED_BUTTON_VALUES = { "pushed", "double", "held", "pushed_3x" }, | ||
| NUMBER_OF_BUTTONS = 4 |
There was a problem hiding this comment.
I'll advise you on why our multi-button profiles include the button capability on the main component: without it (and duplicating any other buttons' events to main, the remote on the device list will not change to indicate button presses. You'll only see them within the device details page.
It seems that you are going to go forward with the profile as is. I am commenting to make sure you have tested the device on the platform to ensure it works the way you want, since this is different than what we have for our multibutton profiles. We recommend having the button capability on the main component, and duplicating events for any button press to that component also, so that in the device list view of the app, you can see the events affect the device rather than in just the details view. Doing so also gives users a hook for routines that will trigger on any button press of the remote.


Check all that apply
Type of Change
Checklist
Description of Change
This PR adds support for the Sonoff SNZB-01M Smart Scene Button to the existing zigbee-button driver.
Changes made:
fingerprints.ymlto recognize the SONOFF SNZB-01M devicesonoff-buttons-battery.ymlwith 4 button components and battery capabilitysrc/zigbee-multi-button/sonoff/init.luato handle SONOFF-specific Zigbee communicationtest_sonoff_button.luafor verification purposesSummary of Completed Tests
Device Testing:
Code Testing:
Compatibility: