Skip to content

[WWSTCERT-13550] Sonoff - Add the pressure display function to SNZB-02M - #3194

Open
laity-w-sudo wants to merge 12 commits into
SmartThingsCommunity:mainfrom
laity-w-sudo:main
Open

[WWSTCERT-13550] Sonoff - Add the pressure display function to SNZB-02M#3194
laity-w-sudo wants to merge 12 commits into
SmartThingsCommunity:mainfrom
laity-w-sudo:main

Conversation

@laity-w-sudo

@laity-w-sudo laity-w-sudo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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

Adding the air pressure function to the SNZB-02M equipment

Summary of Completed Tests

@github-actions

Copy link
Copy Markdown

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions

Copy link
Copy Markdown

Profile category check: ✅ Passed - all profiles have a category defined.

@github-actions

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Test Results

   73 files  ±0    542 suites  +1   0s ⏱️ ±0s
3 267 tests +2  2 822 ✅  - 443  0 💤 ±0  0 ❌ ±0  445 🔥 +445 
5 256 runs  +2  4 667 ✅  - 587  0 💤 ±0  0 ❌ ±0  589 🔥 +589 

For more details on these errors, see this check.

Results for commit 1cd32e1. ± Comparison against base commit 71bbd3d.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

zigbee-humidity-sensor_coverage.xml

File Coverage
All files 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-humidity-sensor/src/sonoff/init.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-humidity-sensor/src/plant-link/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-humidity-sensor/src/frient-sensor/air-quality/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-humidity-sensor/src/lazy_load_subdriver.lua 57%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-humidity-sensor/src/init.lua 93%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 1cd32e1

The SNZB-02M sub-driver was added but never registered, so the
pressure display feature was dead code on the device. Register it
via sub_drivers.lua, drop the unrelated SNZB-02LD/WD handler and
utils (not in this driver, and referencing a nonexistent sub-driver),
and add unit tests for pressure conversion and refresh.

Co-Authored-By: Claude <noreply@anthropic.com>
@laity-w-sudo
laity-w-sudo force-pushed the main branch 2 times, most recently from ae161d5 to b5e3665 Compare August 25, 2026 11:23
Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/sonoff/SNZB-02M/can_handle.lua Outdated
Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/sonoff/SNZB-02M/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/sonoff/SNZB-02M/init.lua Outdated
Comment thread tools/run_driver_tests_p.py Outdated
@KKlimczukS
KKlimczukS requested a review from cbaumler August 31, 2026 09:20
@KKlimczukS KKlimczukS changed the title Add the pressure display function to SNZB-02M [WWSTCERT-13550] Sonoff - Add the pressure display function to SNZB-02M Aug 31, 2026
Comment thread tools/run_driver_tests_p.py
Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/test/test_sonoff_snzb02m.lua Outdated
Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/sub_drivers.lua Outdated

@cjswedes cjswedes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My biggest concern is the lack of configuration for reporting the PressureMeasurement MeasuredValue attribute; has this been tested manually?

Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/sonoff/init.lua
Comment thread drivers/SmartThings/zigbee-humidity-sensor/src/sonoff/SNZB-02M/can_handle.lua Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason to have the nested directories? We should just add a sonoff subdriver rather than having sonoff/SNZB-02M. We want to avoid having single subdrivers for each model.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please change the directory structure so that it is not nested, and everything falls under the sonoff directory.

zigbee_handlers = {
attr = {
[clusters.PressureMeasurement.ID] = {
[clusters.PressureMeasurement.attributes.MeasuredValue.ID] = pressure_report_handler

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you test that the PressureMeasurement attribute is reported automatically when the value changes? I do not see any reporting configuration for the attribute or binding of the cluster. I would expect to see a call in a device_init handler to device:add_configured_attribute to ensure this configuration is setup when the device is configured.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Most clusters get configured due to default functionality, but I dont believe we are configuring this one with the defaults, so the subdriver should be doing so.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@laity-w-sudo
here is the example of cluster configuration in the subdriver:

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.

4 participants