Skip to content

Aqara Wireless Knob Switch H1#2844

Merged
cbaumler merged 5 commits intoSmartThingsCommunity:mainfrom
haedo-doo:AqaraWirelessKnobSwitchH1
Apr 7, 2026
Merged

Aqara Wireless Knob Switch H1#2844
cbaumler merged 5 commits intoSmartThingsCommunity:mainfrom
haedo-doo:AqaraWirelessKnobSwitchH1

Conversation

@haedo-doo
Copy link
Copy Markdown
Contributor

@haedo-doo haedo-doo commented Mar 20, 2026

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

Summary of Completed Tests

@github-actions
Copy link
Copy Markdown

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 20, 2026

Channel deleted.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 20, 2026

Test Results

   72 files    495 suites   0s ⏱️
2 714 tests 2 714 ✅ 0 💤 0 ❌
4 590 runs  4 590 ✅ 0 💤 0 ❌

Results for commit a56dcd1.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 20, 2026

File Coverage
All files 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/shinasystems/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/supported_values.lua 99%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/frient/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/heiman/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/lazy_load_subdriver.lua 57%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/button_utils.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/zunzunbee/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/ikea/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/robb/init.lua 99%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/wallhero/init.lua 87%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/vimar/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/ikea/TRADFRI_remote_control/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/iris/init.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/pushButton/init.lua 76%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/ecosmart/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/aqara/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/somfy/somfy_situo_4/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/SLED/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/aqara-knob/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/adurosmart/init.lua 97%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against a56dcd1

@@ -0,0 +1,149 @@
-- Copyright 2024 SmartThings
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.

nit: Copyright year

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed the copyright year. Thanks for the review!

Copy link
Copy Markdown
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.

Looks pretty good. Just a few small optimizations and a couple extra tests requested to be added.


local function do_configure(driver, device)
device:configure()
device:send(cluster_base.write_manufacturer_specific_attribute(device,
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.

nit: a comment here about what this attribute write is doing would be nice to understand why it is needed.

local sensitivity = tonumber(device.preferences[SENSITIVITY_KEY])
local factor = SENSITIVITY_FACTORS[sensitivity] or 1.0
local intermediate_val = raw_val * factor
local sign = (intermediate_val > 0 and 1) or (intermediate_val < 0 and -1) or 0
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.

very lua-y. Nice!

@hcarter-775
Copy link
Copy Markdown
Contributor

Also, just a reminder to ensure the luacheck passes (removing whitespace, unused variables, etc) before merging. Thanks!

Comment on lines +55 to +56
device:emit_event(capabilities.knob.rotateAmount({value = 0, unit = "%"}))
device:emit_event(capabilities.knob.heldRotateAmount({value = 0, unit = "%"}))
Copy link
Copy Markdown
Contributor

@hcarter-775 hcarter-775 Apr 6, 2026

Choose a reason for hiding this comment

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

Suggested change
device:emit_event(capabilities.knob.rotateAmount({value = 0, unit = "%"}))
device:emit_event(capabilities.knob.heldRotateAmount({value = 0, unit = "%"}))
device:emit_event(capabilities.knob.rotateAmount(0))
device:emit_event(capabilities.knob.heldRotateAmount(0))

nit: The rotate attributes do not support a unit in their arguments. The command passes through fine but the unit does not actually pass into anything. This can be extended to all uses of these attributes.

@cbaumler cbaumler self-requested a review April 6, 2026 15:50
@haedo-doo
Copy link
Copy Markdown
Contributor Author

Thank you @cjswedes and @hcarter-775 for the detailed review! I have updated the code to:

  • Add a descriptive comment for the manufacturer-specific attribute write.
  • Fix the indentation in the rotation handler.
  • Remove the unsupported unit argument from all knob-related capability events.

The tests have also been updated to reflect these changes.

@cbaumler cbaumler merged commit 09cb31c into SmartThingsCommunity:main Apr 7, 2026
11 of 13 checks passed
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