Skip to content

WWSTCERT-10189 Ledvance zigbee meter plug#2729

Open
LQ107 wants to merge 6 commits intoSmartThingsCommunity:mainfrom
LQ107:ledvance_zigbee_meter_plug
Open

WWSTCERT-10189 Ledvance zigbee meter plug#2729
LQ107 wants to merge 6 commits intoSmartThingsCommunity:mainfrom
LQ107:ledvance_zigbee_meter_plug

Conversation

@LQ107
Copy link

@LQ107 LQ107 commented Jan 26, 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

@greens greens changed the title Ledvance zigbee meter plug WWSTCERT-10189 Ledvance zigbee meter plug Feb 4, 2026
Comment on lines +8 to +13
fingerprints:
- manufacturer: "LEDVANCE"
model: "PLUG COMPACT EU EM T"
deviceProfileName: "switch-power-energy"
id: "LEDVANCE/PLUG COMPACT EU EM T"
deviceLabel: "SMART ZIGBEE COMPACT OUTDOOR PLUG EU" No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the changes to this file

Comment on lines -2409 to 2413
deviceProfileName: basic-switch
- id: "JNL/Y-K001-001"
deviceLabel: Yanmi Switch (1 Way)
manufacturer: JNL
model: Y-K001-001
deviceProfileName: basic-switch
- id: "JNL/Y-K002-001"
deviceLabel: Yanmi Switch (2 Way) 1
manufacturer: JNL
model: Y-K002-001
deviceProfileName: basic-switch
zigbeeGeneric:
Copy link
Contributor

Choose a reason for hiding this comment

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

please do not remove other partners' fingerprints

Copy link
Contributor

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?

local can_handle_simple_metering_config = function(opts, driver, device)
-- 检查设备是否支持 Simple Metering 集群 (0x0702)
for _, cluster in ipairs(device.server_clusters) do
if cluster == 0x0702 then
Copy link
Contributor

Choose a reason for hiding this comment

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

we have other devices for which this would return true where we would not want your specific device's logic to be used, which is why we usually gate subdrivers via fingerprints

Comment on lines +10 to +35
local function device_init(driver, device)
-- 在设备初始化时设置 multipliers 和 divisors
device:configure()

-- 设置 Multiplier 为 1
local write_multiplier_cmd = SimpleMetering.server.commands.WriteAttributes(device)
if write_multiplier_cmd then
device:send_to_component(
write_multiplier_cmd({
{id = SimpleMetering.attributes.Multiplier.ID, value = 1, DataType = 0x22} -- 0x22 is 24-bit integer
}),
"main"
)
end

-- 设置 Divisor 为 100
local write_divisor_cmd = SimpleMetering.server.commands.WriteAttributes(device)
if write_divisor_cmd then
device:send_to_component(
write_divisor_cmd({
{id = SimpleMetering.attributes.Divisor.ID, value = 100, DataType = 0x23} -- 0x23 is 32-bit integer
}),
"main"
)
end
end
Copy link
Contributor

Choose a reason for hiding this comment

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

It is often the case that the driver init event happens before the radio is up after a hub restart, resulting in zigbee messages failing to be sent. I would recommend moving these to added or configure, since they likely do not need to be re-sent to the device every time they hub restarts.

Comment on lines +40 to +41
local divisor = device:get_field(SimpleMetering.attributes.Divisor.ID) or 100
local multiplier = device:get_field(SimpleMetering.attributes.Multiplier.ID) or 1
Copy link
Contributor

Choose a reason for hiding this comment

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

this field is not likely to be set. We do set a similar field from "st.zigbee.constants": constants.SIMPLE_METERING_MULTIPLIER_KEY (and divisor) in our defaults, but we never use the attribute ID as a key,

if write_multiplier_cmd then
device:send_to_component(
write_multiplier_cmd({
{id = SimpleMetering.attributes.Multiplier.ID, value = 1, DataType = 0x22} -- 0x22 is 24-bit integer
Copy link
Contributor

@greens greens Feb 4, 2026

Choose a reason for hiding this comment

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

we provide "st.zigbee.data_types" which has a Int24 (and Int32 constant)

if write_divisor_cmd then
device:send_to_component(
write_divisor_cmd({
{id = SimpleMetering.attributes.Divisor.ID, value = 100, DataType = 0x23} -- 0x23 is 32-bit integer
Copy link
Contributor

Choose a reason for hiding this comment

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

in the ZCL this attribute is an Int24

Copy link
Contributor

@greens greens left a comment

Choose a reason for hiding this comment

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

It seems fairly obvious that your AI agent was not up to the task here.

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.

2 participants