Skip to content

Commit 7b9b710

Browse files
committed
CHAD-15951 & 15777: Native handler registration fixes for Matter Powermeter and Z-wave Temperaturemeasurement
1 parent 2a6c1fc commit 7b9b710

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

drivers/SmartThings/matter-switch/src/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,9 @@ local function active_power_handler(driver, device, ib, response)
12061206
local watt_value = ib.data.value / CONVERSION_CONST_MILLIWATT_TO_WATT
12071207
if ib.endpoint_id ~= 0 then
12081208
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.powerMeter.power({ value = watt_value, unit = "W"}))
1209+
if type(device.register_native_capability_attr_handler) == "function" then
1210+
device:register_native_capability_attr_handler("powerMeter","power")
1211+
end
12091212
else
12101213
-- when energy management is defined in the root endpoint(0), replace it with the first switch endpoint and process it.
12111214
device:emit_event_for_endpoint(device:get_field(ENERGY_MANAGEMENT_ENDPOINT), capabilities.powerMeter.power({ value = watt_value, unit = "W"}))

drivers/SmartThings/matter-thermostat/src/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,9 @@ local function active_power_handler(driver, device, ib, response)
19641964
if ib.data.value then
19651965
local watt_value = ib.data.value / 1000
19661966
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.powerMeter.power({ value = watt_value, unit = "W" }))
1967+
if type(device.register_native_capability_attr_handler) == "function" then
1968+
device:register_native_capability_attr_handler("powerMeter","power")
1969+
end
19671970
end
19681971
end
19691972

drivers/SmartThings/zwave-sensor/src/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ local driver_template = {
170170
},
171171
}
172172

173-
defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities)
173+
defaults.register_for_default_handlers(driver_template,
174+
driver_template.supported_capabilities,
175+
{register_native_capability_attr_handler = true})
174176
--- @type st.zwave.Driver
175177
local sensor = ZwaveDriver("zwave_sensor", driver_template)
176178
sensor:run()

0 commit comments

Comments
 (0)