Skip to content

WWST: add Zemismart KES606 four-gang relay/scene switch - #3239

Open
zemismart-dev wants to merge 12 commits into
SmartThingsCommunity:mainfrom
zemismart-dev:codex/kes606-four-gang-certification
Open

zemismart-dev wants to merge 12 commits into
SmartThingsCommunity:mainfrom
zemismart-dev:codex/kes606-four-gang-certification

Conversation

@zemismart-dev

@zemismart-dev zemismart-dev commented Sep 17, 2026 •

Copy link
Copy Markdown

Type of Change

  • WWST Certification Request
    • 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 exact-fingerprint support for the Zemismart KES-606US-L4 (_TZ3000_hurauima / TS0726) under the existing Tuya multi-endpoint driver. The parent exposes an aggregate relay switch, a pushed button and refresh. Four endpoint children expose either switch/refresh or a pushed button.

Both child profiles use the shared boolean preference stse.changeToWirelessSwitch: true requests Scene mode and false requests relay mode. Hardware D020 readback remains the confirmed-mode source and drives profile selection. Parent commands target confirmed relay-mode children; real 0xFD presses emit the matching child and parent button events. On/Off/Toggle commands are not treated as scene presses.

The existing countdown, indicator and global/per-gang power-on preferences are supported. On the tested TS0726 sample, the unscaled countdown fields produced a delayed state change; the observed timing and cancellation evidence are described in the inline review reply. This device-specific observation is not inferred from the standard OnWithTimedOff command name.

Review updates

Commit b7f7df96fa5327a34edb8309ecf1ed88408a11af addresses final review 5852132394: removes the ineffective Tuya subdriver supported_capabilities entry and unused import, removes the manufacturer nil-guard, and shares the relay-mode/profile check through is_relay_child with a short profile-lag comment. Only the three reviewed Lua files changed.

Commit 5cbcc26634b59ba6d24e3d73b3da293a66b03716 addresses review 5700717369: restores the shared ipairs iterator, removes the sparse-endpoint test, applies the suggested early KES606 matcher, adopts the shared wireless-switch preference, and narrows scene handling to observed 0xFD messages. Existing generic Tuya behavior stays covered. Upstream main 352d0f993d744aa6eeb31f01ac78306cec0e29e5 was merged to resolve the branch conflict.

Validation

Current revision b7f7df96fa5327a34edb8309ecf1ed88408a11af: 82/82 focused tests pass on the unmodified official SDK API 21 with Lua 5.3 (KES606 70, generic Tuya 7, existing Tuya multi-switch 5). Luacheck passes for all three changed Lua files with zero warnings/errors; diff checks and independent source review pass. This revision has not been installed or physically tested.

The following validation was recorded for preceding revision 5cbcc26:

  • Official SDK APIs 14, 15, 19 and 21: 82/82 focused tests pass on each (KES606 70, generic Tuya 7, existing Tuya multi-switch 5). Genuine Lua 5.3; official SDK files are unchanged. API 14/15 use only the previously documented separate generated-capability fallbacks.
  • All seven Lua files in the PR pass Luacheck with zero warnings/errors. Profile category, profile structure and exact fingerprint/profile consistency checks pass.
  • Independent source review, diff checks and build-only packaging pass. The updated package has not been uploaded or installed on a Hub. Current upstream CI results are shown in the PR checks and are evaluated separately from local validation.

Hardware and certification status

The October 28 Full Integration session CAMVI9HG0R passed all 45 selected cases with no failures, skips, exclusions or errors, including onboarding and offboarding. It used earlier source ee1aa8d and package 2026-10-27T03:37:11.497994669, with L1/L2 in Switch mode and L3/L4 in Scene mode, on the exact unloaded sample. Same-package evidence also covers indicator modes, seven global/per-gang power-on cycles, all four countdowns/cancellation and real scene events on all four endpoints. Indicator observations and onsite relay confirmation are separate; loaded-contact performance is not claimed.

The first complementary session 9PDO6FTEQ1 remains 42 passed/3 failed because physical presses missed the manual listening windows. Retry VI3CLKKPDY was canceled at the applicant's request (17 passed/28 skipped). Neither is presented as a completed passing complementary report. The updated source in this PR has not yet been physically retested or certified.

Per the certification guidance supplied to us on November 6, after the final code is reviewed and CI passes we will run one Full Integration Test and link it to the product in Console, then manually switch child preferences/profile configurations and provide separate test sessions for the other configurations. We will cover both profiles on all four children and provide the supplementary reports separately. The existing certification request still links the October 13 targeted operational report 66VJTV2QBH (33 passed/18 excluded); no report link or certification submission has been replaced by this code update.

@CLAassistant

CLAassistant commented Sep 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@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 Sep 21, 2026 •

Copy link
Copy Markdown

zigbee-switch_coverage.xml

File Coverage
All files 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/inovelli/vzm32-sn/init.lua 95% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/preferences.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/init.lua 92% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/lazy_load_subdriver.lua 57% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/frient-IO/unbind_request.lua 71% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/frient-IO/init.lua 88% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/init.lua 95% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/configurations/init.lua 98% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua 92% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/firstled-io/init.lua 91% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua 81% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/frient/init.lua 94% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/init.lua 71% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/inovelli/init.lua 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/version/init.lua 94% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/inovelli/vzm30-sn/init.lua 95% ✅

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against ee1aa8d

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Test Results

   73 files  ±  0    546 suites  +5   0s ⏱️ ±0s
3 389 tests +124  3 389 ✅ +124  0 💤 ±0  0 ❌ ±0 
5 389 runs  +135  5 389 ✅ +135  0 💤 ±0  0 ❌ ±0 

Results for commit ee1aa8d. ± Comparison against base commit 87c61ad.

♻️ This comment has been updated with latest results.

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

A refresh-only parent with four independently switchable relay/scene children. Both the existing implementation and candidate tests pass the child automation-presentation checks, while the parent fails the generic requirement for an automation action or condition. We are requesting review of that design; no exception approval is assumed.

I am not sure what to do about this; it may need an exception. My only idea is that the parent could have a switch and button capability on its main component:

  • button is pressed whenever a child device button is pressed (this is inline with functionality of other zigbee button devices)
  • switch controls all child devices that are in the non-scene mode, and if 1 child is on then the parent is on, otherwise it is off.

@zemismart-dev

Copy link
Copy Markdown
Author

Thanks @cjswedes. The parent switch/button suggestion was implemented in 192595d, and the physical failed-case retests are complete:

  • 66VJTV2QBH:33 passed, 0 failed — former parent presentation failure plus parent/four-child relay control.
  • 47NKZ9SQDD:28 passed, 0 failed — parent aggregate pushed, L2/L3/L4 real scene presses, and mixed-mode switch checks.
  • 7YSI12M2VD:20 passed, 0 failed — L1 real scene press, completing all four scene channels.

These are targeted operational reports with documented exclusions, not a new Full Integration Test. A separate mixed-mode regression confirmed master commands skip Scene gangs and aggregate state follows eligible relay reports. All four gangs were restored to Switch; the final parent on/off regression and operator confirmation ended with all loads off. The submitted certification report's notes now reference the new evidence.

I have also pushed 09a4655 for the matcher/nested-dispatch feedback and replied to all four inline comments. Focused API 19/API 21 suites each pass 140/140; lint and independent review passed. Full local zigbee-switch runs have the same pre-existing failing-case sets as the clean 192595d baseline; they are not reported as all-green. This new routing revision is locally validated only; the physical reports above remain associated with 192595d and package 2026-10-13T07:18:46.468510907.

The shared-preference comment has a compatibility explanation and a request for guidance on safe mode-preference migration. No certification approval is assumed.

@zemismart-dev

Copy link
Copy Markdown
Author

Follow-up on the October 15 CI results: firmware 59, 60, 61 and dev passed, while 57 and 58 reported six failures. I reproduced those same six failures with the official API 14/15 runtimes: the tests expected v2 module-path dispatcher names, but the legacy loader retains each template's NAME. Actual nested routing was present.

Fixed in 5fd6d98. Only the two test files changed. The assertions now use the appropriate loader naming convention; no tests are skipped, and the topology, lazy-loading, generic-Tuya isolation and protocol checks are preserved. No production driver or profile changes are included.

Validation: API 14, 15, 19 and 21 each pass all 140 focused tests; lint and independent review pass. For the legacy SDK archives, a separate fallback directory supplies only two missing generated capability definitions from official API 21 (statelessColorTemperatureStep and statelessSwitchLevelStep); SDK runtime code and existing definitions are unchanged.

The new upstream CI run is pending. The October 15 routing revision still requires physical Hub validation; the October 13 hardware reports remain evidence for 192595d, not this revision. The shared-preference migration question in the inline review remains open.

@zemismart-dev
zemismart-dev marked this pull request as ready for review October 19, 2026 01:10
@cjswedes
cjswedes requested a review from KKlimczukS October 19, 2026 14:24

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

There is more I could review due to all the extra complexity in this PR; please simplify this implementation. Your AI really overcomplicated this, and I wont approve in its current state.

@zemismart-dev

zemismart-dev commented Oct 21, 2026 •

Copy link
Copy Markdown
Author

Simplified in 8bda664 and replied to all six inline comments. The dedicated sub-driver is now 284 lines instead of 484, with standard child routing/handlers, inherited configuration/refresh and one D020-confirmed mode source. Unused fields/read/report handlers and legacy-parent migration are removed; profiles use generic names.

Official SDK API 14/15/19/21 each pass all 82 focused tests. Lint, independent review and build-only packaging pass; no SDK runtime patches were used. The PR description now reflects the final implementation and its last-known aggregate-state semantics.

The new revision has not been installed on the physical Hub. Clean-pair hardware validation is still required, and the October13 reports remain tied to their original commit/package. Upstream Driver Tests for this exact head all passed: 57: 4037 passed, 0 failed, 58: 4834 passed, 0 failed, 59: 5213 passed, 0 failed, 60: 5310 passed, 0 failed, 61: 5326 passed, 0 failed, dev: 5330 passed, 0 failed. Could you re-review this simplification, @cjswedes? Please let me know if further changes are needed.

@zemismart-dev

Copy link
Copy Markdown
Author

@cjswedes @KKlimczukS, could you help confirm the STTS validation plan before we arrange the final on-device run?

The certification team has requested a complete Full Integration Test report. The currently linked 66VJTV2QBH is a targeted retest (33 passed, 0 failed, 18 user-excluded), not complete integration evidence. We will not treat the combined operational retests as a substitute for the required full flow.

This device's children change between Switch and Button profiles according to their relay/scene mode, while the parent exposes both. In our previous STTS run, the parent Button case initialization expected the parent Switch to turn on. An all-Scene configuration has no eligible relay targets, so that setup could not complete initialization; a mixed configuration worked.

Could you confirm:

  1. For complete coverage of both child modes, should we run Full Integration with mixed modes and a second Full Integration with complementary modes, or is one complete Full Integration plus supplemental alternate-mode tests acceptable? We intend to complete onboarding, all applicable functionality/manual/feedback cases and offboarding, without excluding required cases.
  2. Is the current simplification at 8bda664 ready for this physical validation, or are further source changes required first?

If the certification team must decide the first point, please help route this specific coverage question to them. We will record the exact installed driver package and profile configuration for the eventual reports.

@KKlimczukS

Copy link
Copy Markdown
Contributor

@cjswedes @KKlimczukS, could you help confirm the STTS validation plan before we arrange the final on-device run?

The certification team has requested a complete Full Integration Test report. The currently linked 66VJTV2QBH is a targeted retest (33 passed, 0 failed, 18 user-excluded), not complete integration evidence. We will not treat the combined operational retests as a substitute for the required full flow.

This device's children change between Switch and Button profiles according to their relay/scene mode, while the parent exposes both. In our previous STTS run, the parent Button case initialization expected the parent Switch to turn on. An all-Scene configuration has no eligible relay targets, so that setup could not complete initialization; a mixed configuration worked.

Could you confirm:

  1. For complete coverage of both child modes, should we run Full Integration with mixed modes and a second Full Integration with complementary modes, or is one complete Full Integration plus supplemental alternate-mode tests acceptable? We intend to complete onboarding, all applicable functionality/manual/feedback cases and offboarding, without excluding required cases.
  2. Is the current simplification at 8bda664 ready for this physical validation, or are further source changes required first?

If the certification team must decide the first point, please help route this specific coverage question to them. We will record the exact installed driver package and profile configuration for the eventual reports.

@zemismart-dev
Please, could You share here those test results ? (You can download it from the test suite test session page)

  • Full Integration with mixed modes
  • second Full Integration with complementary modes

I'd like to take a look first.

@zemismart-dev

zemismart-dev commented Oct 27, 2026 •

Copy link
Copy Markdown
Author

@KKlimczukS The two requested mixed-mode and complementary-mode Full Integration reports have not been generated yet. The three October 13 reports remain targeted operational evidence, not substitutes for those full sessions.

October 27 update: we installed commit ee1aa8d1c986b62e198edad5ce38439a8c46844a as development package 2026-10-27T03:37:11.497994669 on the same exact-fingerprint sample. Fresh pairing created the parent and four children with keys 01–04. On the unloaded sample, seven power cycles verified global On/Off/Memory and each gang's On/Off/Memory behavior, supported by device attribute reports, OnOff reports/reads and the onsite operator. Indicator modes, all four countdowns and countdown cancellation were also checked. These are pre-session hardware checks; current-revision scene-event coverage and the complete STTS flow remain outstanding.

We are currently blocked by the Test Suite. After sign-in and reloads, the device list returns HTTP 503 from /api/client/pastora/testsuite/v2/devices (observed at 2026-10-27 07:40 UTC), while the other Console organization/product requests return 200. The Full Integration creation page opens, but both attempts to start onboarding end with “Service Temporarily Unavailable”; the UI does not display a new onboarding session ID. Could you check whether this is a known Test Suite issue or advise the appropriate support route?

The sample has been paired back to the original test Hub and all four relays are verified Off. We will share the actual downloaded reports once the two complete sessions can run. We have not canceled or resubmitted the certification request during this attempt.

@Mateuszp90

Copy link
Copy Markdown

@zemismart-dev
Please try again. The 503 error should now be fixed.

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

Thank you for the simplification. This is getting much closer, but still a few things.

@zemismart-dev

zemismart-dev commented Nov 6, 2026 •

Copy link
Copy Markdown
Author

@cjswedes @KKlimczukS All five comments in review 5700717369 have been addressed and replied to individually in 5cbcc26634b59ba6d24e3d73b3da293a66b03716. The branch is merged with current upstream main and is mergeable again.

Local validation: official SDK APIs 14/15/19/21 each pass 82/82 focused tests; all seven Lua files in the PR pass Luacheck; profile/fingerprint checks, build-only packaging and independent source review pass. The SDK copies are unmodified. The countdown and scene-command replies include the existing raw hardware observations and their limits.

The new head's six actual Driver Tests have now passed with zero failures: 57=4092, 58=4911, 59=5348, 60=5451, 61=5467, dev=5471; the CLA check also passes. Six other fork Actions still require maintainer authorization. Could you authorize those workflows and re-review this revision?

The certification guidance supplied to us on November 6 is to link one Full Integration Test to the product after code review/CI are complete, then manually switch preferences/profile configurations and provide separate test-session reports for the other configurations. We will cover both child profiles on all four gangs and supply those supplementary results separately. The earlier 45/45 Full report CAMVI9HG0R remains evidence for ee1aa8d, not this new revision; this update does not install a Hub package or resubmit certification.

@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 will approve once my final review comments are addressed. Thank you for iterating on this.

Comment on lines +50 to +52
supported_capabilities = {
capabilities.switch
},

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.

Suggested change
supported_capabilities = {
capabilities.switch
},

This does nothing on a subdriver and should be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed supported_capabilities from the Tuya subdriver and its now-unused st.capabilities import in b7f7df96fa5327a34edb8309ecf1ed88408a11af.

local TUYA_MFR_HEADER = "_TZ"
if string.sub(device:get_manufacturer(),1,3) == TUYA_MFR_HEADER and is_multi_endpoint(device) then -- if it is a tuya device, then send the magic packet
local manufacturer = device:get_manufacturer()
if manufacturer ~= nil and string.sub(manufacturer,1,3) == TUYA_MFR_HEADER and is_multi_endpoint(device) then -- if it is a tuya device, then send the magic packet

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.

The nil-guard on manufacturer is unnecessary, please drop it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed the manufacturer nil-guard in b7f7df96fa5327a34edb8309ecf1ed88408a11af. The remaining matcher conditions and their order are unchanged.

if device.network_type == device_lib.NETWORK_TYPE_ZIGBEE then
for endpoint = 1, 4 do
local child = find_child(device, endpoint)
if is_relay(device, child) and child:supports_capability(capabilities.switch) then

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.

The is_relay(...) and child:supports_capability(capabilities.switch) pair is repeated in four places. A single is_relay_child(parent, child) helper that includes a short comment on the profile-lag reason for checking both would make the intent clear.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added is_relay_child(parent, child) in b7f7df96fa5327a34edb8309ecf1ed88408a11af and replaced the repeated combined checks, including the profile-completion path. Its short comment explains that confirmed relay mode can arrive before the child Switch profile finishes updating; both checks remain intact.

All 82 focused tests pass on the unmodified official SDK API 21 with Lua 5.3 (70 KES606, 7 generic Tuya, 5 existing Tuya multi-switch). Luacheck passes for the three changed Lua files with zero warnings/errors, and independent source review passes. Only these three final review comments were changed. This revision has not been installed or physically retested. Could you re-review it when convenient?

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.

5 participants