-
Notifications
You must be signed in to change notification settings - Fork 530
WWSTCERT-10189 Ledvance zigbee meter plug #2729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cbaumler
merged 42 commits into
SmartThingsCommunity:main
from
LQ107:ledvance_zigbee_meter_plug
Apr 21, 2026
Merged
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
c8278e8
ledvance zigbee meter plug driver pull
LQ107 316276d
add the handle file
LQ107 c01a9d0
add driver fingerprints
LQ107 5e5a387
modify the ledvance zigbee meter plug device Label
LQ107 98aafe1
add driver for PLUG EU EM T
LQ107 6a76283
delete the PLUG EU EM T driver
LQ107 14de7ba
Update the PLUG COMPACT EU EM T device driver
LQ107 99ce6ea
set the multiplier and divisor fields in the initial handler
LQ107 22bc75b
disable the rely on the defaults to read the multiplier/divisor and A…
LQ107 b81fa6b
fixing the init.lua multiplier/divisor handle ,fixing the commit conf…
LQ107 328797c
update sub driver init.lua files
LQ107 8f598e7
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 5004c95
Remove unnecessary files
LQ107 09b89b7
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 3a46f9d
Remove redundant code
LQ107 b7eb6b6
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 6b409cb
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 41d31e7
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 28e7783
1.add the test unit 2. add sub driver register 3.fixing the energy_me…
LQ107 875c75f
revert the gitgnore file to the default
LQ107 4011278
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 3347541
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 6063c89
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 9424f57
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 2f5fe4b
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 d02ef90
1.fixing the energy meter value redundant processing 2.change the lo…
LQ107 c6d53e8
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 6ee58b2
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 2c5a233
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 420f963
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 4650e24
1.Use the default SmartThings simple metering handlers
LQ107 5e6d9d6
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 542e724
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 bea9429
fixing the following issue:
LQ107 d0f3ccb
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 d555fe4
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 0d04304
Fix the issues of missing trailing newline and remove trailing white …
LQ107 d25cf5c
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 905fe30
Merge branch 'main' into ledvance_zigbee_meter_plug
LQ107 c4f13dd
1.rename the driver file name to ledvance-metering-plug 2.keep the g…
LQ107 c651f91
Merge branch 'ledvance_zigbee_meter_plug' of https://github.com/LQ107…
LQ107 c81e7e3
keep gitignore same to the main branch
LQ107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
drivers/SmartThings/zigbee-switch/src/simple-metering-config/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| return function(opts, driver, device, ...) | ||
| local FINGERPRINTS = require("simple-metering-config.fingerprints") | ||
| for _, fingerprint in ipairs(FINGERPRINTS) do | ||
| if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then | ||
| local subdriver = require("simple-metering-config") | ||
| return true, subdriver | ||
| end | ||
| end | ||
| return false | ||
| end | ||
|
LQ107 marked this conversation as resolved.
Outdated
|
||
6 changes: 6 additions & 0 deletions
6
drivers/SmartThings/zigbee-switch/src/simple-metering-config/fingerprints.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| return { | ||
| { mfr = "LEDVANCE", model = "PLUG COMPACT EU EM T" } | ||
| } | ||
|
LQ107 marked this conversation as resolved.
Outdated
|
||
28 changes: 28 additions & 0 deletions
28
drivers/SmartThings/zigbee-switch/src/simple-metering-config/init.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local capabilities = require "st.capabilities" | ||
| local zigbee_constants = require "st.zigbee.constants" | ||
|
|
||
| local function device_init(driver, device) | ||
| if device:get_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY) == nil then | ||
| device:set_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY, 1, {persist = true}) | ||
| end | ||
| if device:get_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY) == nil then | ||
| device:set_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY, 100, {persist = true}) | ||
| end | ||
| end | ||
|
LQ107 marked this conversation as resolved.
|
||
|
|
||
| local simple_metering_config_subdriver = { | ||
| NAME = "Simple Metering Config", | ||
| supported_capabilities = { | ||
| capabilities.energyMeter, | ||
| capabilities.powerMeter | ||
| }, | ||
|
LQ107 marked this conversation as resolved.
Outdated
|
||
| lifecycle_handlers = { | ||
| init = device_init | ||
| }, | ||
| can_handle = require("simple-metering-config.can_handle") | ||
| } | ||
|
|
||
| return simple_metering_config_subdriver | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
drivers/SmartThings/zigbee-switch/src/test/test_simple_metering_config.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local test = require "integration_test" | ||
| local zigbee_test_utils = require "integration_test.zigbee_test_utils" | ||
| local t_utils = require "integration_test.utils" | ||
| local zigbee_constants = require "st.zigbee.constants" | ||
|
|
||
| local mock_device = test.mock_device.build_test_zigbee_device( | ||
| { | ||
| profile = t_utils.get_profile_definition("switch-power-energy.yml"), | ||
| zigbee_endpoints = { | ||
| [1] = { | ||
| id = 1, | ||
| manufacturer = "LEDVANCE", | ||
| model = "PLUG COMPACT EU EM T", | ||
| server_clusters = { 0x0006, 0x0702 } | ||
| } | ||
| } | ||
| } | ||
| ) | ||
|
|
||
| zigbee_test_utils.prepare_zigbee_env_info() | ||
|
|
||
| local function test_init() | ||
| test.mock_device.add_test_device(mock_device) | ||
| end | ||
|
|
||
| test.set_test_init_function(test_init) | ||
|
|
||
| test.register_coroutine_test( | ||
| "Device init should set default multiplier and divisor only when not already set", | ||
| function() | ||
| assert(mock_device:get_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY) == nil) | ||
| assert(mock_device:get_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY) == nil) | ||
| test.socket.device_lifecycle:__queue_receive({ mock_device.id, "init" }) | ||
| test.wait_for_events() | ||
| assert(mock_device:get_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY) == 1) | ||
| assert(mock_device:get_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY) == 100) | ||
| end | ||
| ) | ||
|
|
||
| test.register_coroutine_test( | ||
| "Device init should preserve device-reported multiplier and divisor", | ||
| function() | ||
| mock_device:set_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY, 5, {persist = true}) | ||
| mock_device:set_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY, 1000, {persist = true}) | ||
| test.socket.device_lifecycle:__queue_receive({ mock_device.id, "init" }) | ||
| test.wait_for_events() | ||
| assert(mock_device:get_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY) == 5) | ||
| assert(mock_device:get_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY) == 1000) | ||
| end | ||
| ) | ||
|
|
||
| test.run_registered_tests() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.