Skip to content

Conversation

@haedo-doo
Copy link
Contributor

@haedo-doo haedo-doo commented Oct 15, 2025

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

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

Channel deleted.

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

Test Results

   71 files    468 suites   0s ⏱️
2 455 tests 2 455 ✅ 0 💤 0 ❌
4 168 runs  4 168 ✅ 0 💤 0 ❌

Results for commit 260854a.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

File Coverage
All files 97%
/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 94%
/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/wallhero/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/frient/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/inovelli/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/lifecycle_handlers/device_added.lua 70%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/jasco/init.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/tuya-multi/can_handle.lua 90%
/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/aqara-light/init.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/configurations/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua 87%
/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/ge-link-bulb/init.lua 93%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 260854a


local devices = {
AQARA_LIGHT = {
MATCHING_MATRIX = { mfr = "LUMI", model = "lumi.light.acn004" },
Copy link
Contributor

Choose a reason for hiding this comment

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

you should just be able to add the new model here rather than duplicating this map entirely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the late confirmation. It's been updated—please check again.

Comment on lines 58 to 80
local function init(self, device)
local min = 2700
local max = 6000

if device:get_model() == "lumi.light.cwacn1" then
max = 6500
end
device:emit_event(capabilities.colorTemperature.colorTemperatureRange({ minimum = min, maximum = max }))
end

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the instinct here so that existing devices get this change, but we do not want this event to fire every time the driver starts.

I would add this event to the added handler as well, and a follow-up PR a week later should be created to remove this code here in init. I'd also add gating to check for an existing colorTemperatureRange value before emitting this event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'm a bit confused. Should I add this event to the added handler and remove the one in init in a follow-up PR a week later—instead of doing it now?

Copy link
Contributor

Choose a reason for hiding this comment

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

So we want to make sure that existing already-installed devices get this change, which is (I assumed) why you placed it in init, since that is called every time the driver starts, rather than in added, which is only called once in the lifecycle of the device.

In general, this code should only be in the added handler, but for a week, I recommend having it in both added and init so that already-installed devices will update.

After that there should be a follow-up PR to remove the code from init since it will no longer be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, got it. I'll add this event to the added handler first and remove the code from init in a follow-up PR later. Thanks!

@greens greens changed the title Aqara dimmer controller t1 WWSTCERT-8419 Aqara dimmer controller t1 Oct 23, 2025
@greens greens changed the title WWSTCERT-8419 Aqara dimmer controller t1 WWSTCERT-8419/8461 Aqara dimmer controller t1 Oct 23, 2025
@greens greens changed the title WWSTCERT-8419/8461 Aqara dimmer controller t1 WWSTCERT-8461 Aqara dimmer controller t1 Oct 28, 2025
Comment on lines 85 to 103
local matrix = device.MATCHING_MATRIX
if not matrix then goto continue end

-- Single table format: { mfr = "...", model = "..." }
if matrix.mfr and matrix.model then
if matrix.mfr == mfr and matrix.model == model then
return device.PARAMETERS
end
goto continue
end
-- Array format: { { mfr = "...", model = "..." }, ... }
if type(matrix) == "table" then
for _, match in ipairs(matrix) do
if match.mfr == mfr and match.model == model then
return device.PARAMETERS
end
end
end
::continue::
Copy link
Contributor

Choose a reason for hiding this comment

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

what was the bug here that required this rewrite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I add the new model here rather than duplicating the entire map, preferences won't work properly because the existing get_device_parameters function can't handle the Array format for the model.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've left some suggestions that seem a lot simpler than this rewrite, based on how this is handled elsewhere in the code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestions, I've updated the code.

}
},
AQARA_LIGHT_BULB = {
MATCHING_MATRIX = { mfr = "Aqara", model = "lumi.light.acn014" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MATCHING_MATRIX = {
{ mfr = "Aqara", model = "lumi.light.acn014" },
}

if device:get_model() == "lumi.light.cwacn1" then
max = 6500
end
device:emit_event(capabilities.colorTemperature.colorTemperatureRange({ minimum = min, maximum = max }))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the emit_event_if_latest_state_missing check for this code, since it runs every time the driver starts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, done.

@greens
Copy link
Contributor

greens commented Nov 17, 2025

You will need to rebase now, as we did a major reconfiguration of the zigbee switch driver code to reduce memory usage

@haedo-doo haedo-doo force-pushed the Aqara-DimmerControllerT1 branch from ce4156c to b13bde7 Compare November 18, 2025 00:24
@haedo-doo
Copy link
Contributor Author

You will need to rebase now, as we did a major reconfiguration of the zigbee switch driver code to reduce memory usage

I've rebased.

@greens greens merged commit 1f59baa into SmartThingsCommunity:main Dec 2, 2025
12 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.

3 participants