WWSTCERT-10189 Ledvance zigbee meter plug#2729
WWSTCERT-10189 Ledvance zigbee meter plug#2729LQ107 wants to merge 6 commits intoSmartThingsCommunity:mainfrom
Conversation
| 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 |
There was a problem hiding this comment.
please remove the changes to this file
| 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: |
There was a problem hiding this comment.
please do not remove other partners' fingerprints
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
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.
| local divisor = device:get_field(SimpleMetering.attributes.Divisor.ID) or 100 | ||
| local multiplier = device:get_field(SimpleMetering.attributes.Multiplier.ID) or 1 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
in the ZCL this attribute is an Int24
Check all that apply
Type of Change
Checklist
Description of Change
Summary of Completed Tests