Skip to content

Conversation

wkhenon
Copy link
Contributor

@wkhenon wkhenon commented Sep 30, 2025

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

This pull request defaults handing for on, off, set_level, and set_color_temperature in the ZLL sub-driver back to the main zigbee-switch driver.

Summary of Completed Tests

Copy link

Copy link

github-actions bot commented Sep 30, 2025

Test Results

   71 files    455 suites   0s ⏱️
2 355 tests 2 352 ✅ 0 💤  3 ❌
3 978 runs  3 967 ✅ 0 💤 11 ❌

For more details on these failures, see this check.

Results for commit 407d268.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Sep 30, 2025

File Coverage
All files 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua 93%
/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 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/frient/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/inovelli-vzm31-sn/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/wallhero/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/jasco/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/tuya-multi/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/ge-link-bulb/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/version/init.lua 94%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 407d268

@wkhenon wkhenon force-pushed the defaults-for-zll-subdrivers branch from f541dd9 to 5a0c5ab Compare October 1, 2025 20:23
@wkhenon wkhenon self-assigned this Oct 6, 2025
@wkhenon wkhenon force-pushed the defaults-for-zll-subdrivers branch from cce4958 to 7fc35dc Compare October 6, 2025 19:03
@wkhenon wkhenon force-pushed the defaults-for-zll-subdrivers branch 3 times, most recently from 32d969f to 6e40aa4 Compare October 6, 2025 19:43

test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) })
test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) })
if version.api <= 15 then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was having issues running the setColorTemperature tests locally with this operator set to <= (no issues with <). Would this be pointing to a problem with how I'm using the version? Or is there some Lua magic that I'm missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well the way you've written things, wouldn't the initial on/offs also not be sent when the native handlers are used?

@cjswedes probably has more insight here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are there version checks at all for the polling/read messages? I expected there to only be a version check on the native handler registration call. The polling messages after the fact should remain the same whether the lua libs default handler is called or the subdriver is used because.

Copy link
Contributor

@cjswedes cjswedes left a comment

Choose a reason for hiding this comment

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

The entire zll-dimmer-bulb subdriver will no longer be necessary on api version 16 since we will put zll handling into the default handlers, so I think rather than changing the can_handle, it would be preferable to instantiate the subdriver conditionally based on the api version in the base driver

@greens
Copy link
Contributor

greens commented Oct 8, 2025

@cjswedes is there that much difference between having the lazy-loaded can_handle check the version vs checking the version before loading at all? Because checking the version before loading looks pretty non-idiomatic.

Copy link

@pegor-karoglanian pegor-karoglanian left a comment

Choose a reason for hiding this comment

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

LGTM!

@cjswedes
Copy link
Contributor

cjswedes commented Oct 8, 2025

@cjswedes is there that much difference between having the lazy-loaded can_handle check the version vs checking the version before loading at all? Because checking the version before loading looks pretty non-idiomatic.

I think there is a decent sized difference. When we startup and "lazily" load the subdrivers, what were actually doing is the following:

  • requiring them all one by one in their entirety
  • extracting the can_handle function and any upvalues it needs
  • dropping references to everything else
  • collecting garbage

So some differences with what I suggested are:

  • less latency at startup
  • less latency in all event handling (since its one less can_handle)
  • small memory savings
  • less maintenance of a subdriver that should never be used

I dont think the latency and memory savings are that much, but it would be nice to get rid of a subdriver since it isnt needed anymore. Why cut out every individual handler when you can just cut out the whole subdriver?

@wkhenon wkhenon force-pushed the defaults-for-zll-subdrivers branch from 3cfeae0 to 10939c4 Compare October 9, 2025 00:53
…or testing with version 16):

- adding `E13-N11` to `zll-polling` allowed `doConfigure` test of `test_sengled_dimmer_bulb_with_motion_sensor.lua` to pass
- requiring the `zll-dimmer-bulb/ikea-xy-color-bulb` subdriver in the `zigbee-switch` driver allowed all the tests to pass in `test_zll_rgb_bulb.lua`
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