-
Notifications
You must be signed in to change notification settings - Fork 524
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
Open
LQ107
wants to merge
7
commits into
SmartThingsCommunity:main
Choose a base branch
from
LQ107:ledvance_zigbee_meter_plug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 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 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
8 changes: 8 additions & 0 deletions
8
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,8 @@ | ||
| -- Copyright 2025 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local can_handle_simple_metering_config = function(opts, driver, device) | ||
| return device.fingerprinted == true | ||
| end | ||
|
|
||
| return can_handle_simple_metering_config |
12 changes: 12 additions & 0 deletions
12
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,12 @@ | ||
| -- Copyright 2025 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| return { | ||
| ["LEDVANCE"] = { | ||
| ["PLUG COMPACT EU EM T"] = { | ||
| deviceProfileName = "switch-power-energy", | ||
| --id = "LEDVANCE/PLUG COMPACT EU EM T", | ||
| --deviceLabel = "SMART ZIGBEE COMPACT OUTDOOR PLUG EU" | ||
| } | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
| -- Copyright 2025 SmartThings, Inc. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. date |
||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local capabilities = require "st.capabilities" | ||
| local zigbee_constants = require "st.zigbee.constants" | ||
| local SimpleMetering = require "st.zigbee.cluster".clusters.SimpleMetering | ||
|
|
||
| local function energy_meter_handler(driver, device, value, zb_rx) | ||
| local raw_value = value.value | ||
|
|
||
| if type(raw_value) ~= "number" or raw_value < 0 then | ||
| return | ||
| end | ||
|
|
||
| local divisor = device:get_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY) or 100 | ||
| local multiplier = device:get_field(zigbee_constants.SIMPLE_METERING_MULTIPLIER_KEY) or 1 | ||
|
|
||
| if divisor == 0 then | ||
| return | ||
| end | ||
|
|
||
| local calculated_value = (raw_value * multiplier) / divisor | ||
|
|
||
| device:emit_event_for_endpoint( | ||
| zb_rx.address_header.src_endpoint.value, | ||
| capabilities.energyMeter.energy({ value = calculated_value, unit = "kWh" }) | ||
| ) | ||
| end | ||
|
Comment on lines
+8
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. our default handlers should handle this case, provided your device properly reports its simple metering multiplier and divisor. |
||
|
|
||
| local simple_metering_config_subdriver = { | ||
| supported_capabilities = { | ||
| capabilities.energyMeter, | ||
| capabilities.powerMeter | ||
| }, | ||
| zigbee_handlers = { | ||
| cluster = { | ||
| [SimpleMetering.ID] = { | ||
| [SimpleMetering.attributes.CurrentSummationDelivered.ID] = energy_meter_handler | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return simple_metering_config_subdriver | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure where this file is used?