Skip to content

[WWSTCERT-14007] Add SONOFF TP-WGZBA Zigbee thermostat support - #3241

Merged
KKlimczukS merged 12 commits into
SmartThingsCommunity:mainfrom
viys:tp-wgzba
Oct 12, 2026
Merged

KKlimczukS merged 12 commits into
SmartThingsCommunity:mainfrom
viys:tp-wgzba

Conversation

@viys

@viys viys commented Sep 21, 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

Add SONOFF TP-WGZBA support to the zigbee-thermostat driver.

  • Manufacturer: SONOFF
  • Model: TP-WGZBA
  • Protocol: Zigbee
  • Driver: zigbee-thermostat (new sonoff / sonoff.tp_wgzba sub-drivers)

Implementation

  1. Fingerprint SONOFF/TP-WGZBA → profile thermostat-sonoff
  2. Standard Thermostat cluster for mode, heating setpoint, operating state, and local temperature calibration
  3. Manufacturer-specific cluster 0xFC11 (mfg 0x1286) for child lock, open-window, temporary/override mode, radar, screen, relay polarity, NTC, and overheat protection
  4. Integration tests aligned with current sonoff/tp_wgzba/init.lua behavior

Summary of Completed Tests

  • test_sonoff_tp_wgzba_thermostat.lua: 25/25 passed (local Lua 5.3 + capability definitions)
  • Covered: lifecycle (init/added/driverSwitched/doConfigure), refresh, standard thermostat reports/commands, private attribute reports/writes, temporary mode commands, threshold/time-period/relay capability writes

@CLAassistant

CLAassistant commented Sep 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Channel deleted.

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

zigbee-thermostat_coverage.xml

File Coverage
All files 94% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/lux-konoz/can_handle.lua 83% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/lazy_load_subdriver.lua 57% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/init.lua 98% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/wallhero/init.lua 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/popp/init.lua 92% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/resideo_korea/init.lua 90% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/stelpro/init.lua 87% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/stelpro-ki-zigbee-thermostat/init.lua 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua 95% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/vimar/init.lua 89% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/zenwithin/init.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/sonoff/tp_wgzba/init.lua 82% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/aqara/init.lua 94% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/sinope/init.lua 97% ✅

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against b5f63bb

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Test Results

   73 files    543 suites   0s ⏱️
3 295 tests 3 295 ✅ 0 💤 0 ❌
5 284 runs  5 284 ✅ 0 💤 0 ❌

Results for commit b5f63bb.

♻️ This comment has been updated with latest results.

@viys
viys marked this pull request as ready for review September 22, 2026 07:12
Comment thread drivers/SmartThings/zigbee-thermostat/profiles/thermostat-sonoff.yml Outdated
@KKlimczukS KKlimczukS changed the title Add SONOFF TP-WGZBA Zigbee thermostat support [WWSTCERT-13857] Add SONOFF TP-WGZBA Zigbee thermostat support Sep 23, 2026
@KKlimczukS
KKlimczukS requested a review from cbaumler September 23, 2026 13:45

@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.

Along with @KKlimczukS feedback about the custom capabilitites being shifted to preferences, the entire tp_wgzba subdriver is not necessary; it can all live under the sonoff subdriver since there is only one model using this functionality at the moment.

There also seems to be a huge amount of helper code to support these manufacturer specific clusters; we have set up the libraries to do a lot of this for you, and you should try to use that functionality.

Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/tp_wgzba/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/tp_wgzba/init.lua
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/tp_wgzba/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.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.

I think all but the preference handling can likely be handled by the base driver and default handler implementations.

Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
Comment thread drivers/SmartThings/zigbee-thermostat/src/sonoff/init.lua Outdated
viys added 4 commits October 8, 2026 11:28
- Encode boolean preferences backed by Uint8 attributes as 0/1 so the Bluetooth pairing broadcast write is actually sent.
- Build the temporary-mode payload with string.pack; keep the frame without a manufacturer code, as required by the device firmware.
- Rely on base driver and default handlers for temperature, heating setpoint, thermostat mode, running state, driverSwitched and firmware version.
- Emit supported thermostat modes in doConfigure.
- Shorten preference names to the platform's 24-character limit.
Keep the SONOFF TRV-ZBT sub-driver from main and move TP-WGZBA into sonoff.tp_wgzba so both devices can match.
@KKlimczukS
KKlimczukS requested a review from cjswedes October 8, 2026 11:29

@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.

I think the base sonoff driver can handle the preferences defined here as well with a little refactoring, but that is out of the scope of this PR I think . Nice work.

@cjswedes
cjswedes requested a review from KKlimczukS October 9, 2026 15:27

@KKlimczukS KKlimczukS 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.

lgtm

@KKlimczukS
KKlimczukS merged commit ac618da into SmartThingsCommunity:main Oct 12, 2026
25 checks passed
@KKlimczukS KKlimczukS changed the title [WWSTCERT-13857] Add SONOFF TP-WGZBA Zigbee thermostat support Add SONOFF TP-WGZBA Zigbee thermostat support Oct 12, 2026
@KKlimczukS KKlimczukS changed the title Add SONOFF TP-WGZBA Zigbee thermostat support [WWSTCERT-14007] Add SONOFF TP-WGZBA Zigbee thermostat support Oct 15, 2026
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