Skip to content

Commit aee0647

Browse files
committed
persist profiling field
1 parent 5d02b98 commit aee0647

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drivers/SmartThings/matter-switch/src/generic_handlers/attribute_handlers.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ function AttributeHandlers.available_endpoints_handler(driver, device, ib, respo
344344
return
345345
end
346346

347-
device:set_field(fields.profiling_data.POWER_TOPOLOGY, clusters.PowerTopology.types.Feature.SET_TOPOLOGY)
347+
device:set_field(fields.profiling_data.POWER_TOPOLOGY, clusters.PowerTopology.types.Feature.SET_TOPOLOGY, {persist=true})
348348
device_cfg.match_profile(driver, device)
349349
end
350350

@@ -372,7 +372,7 @@ function AttributeHandlers.parts_list_handler(driver, device, ib, response)
372372
return
373373
end
374374

375-
device:set_field(fields.profiling_data.POWER_TOPOLOGY, clusters.PowerTopology.types.Feature.TREE_TOPOLOGY)
375+
device:set_field(fields.profiling_data.POWER_TOPOLOGY, clusters.PowerTopology.types.Feature.TREE_TOPOLOGY, {persist=true})
376376
device_cfg.match_profile(driver, device)
377377
end
378378

drivers/SmartThings/matter-switch/src/utils/switch_utils.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ function utils.handle_electrical_sensor_info(device)
272272

273273
local electrical_ep_has_feature = function(feature_name)
274274
local feature = clusters.PowerTopology.types.Feature[feature_name]
275-
return clusters.PowerTopology.are_features_supported(feature, electrical_ep[clusters.PowerTopology.ID] or 0)
275+
if feature then
276+
return clusters.PowerTopology.are_features_supported(feature, electrical_ep[clusters.PowerTopology.ID] or 0)
277+
end
276278
end
277279

278280
if electrical_ep_has_feature("SET_TOPOLOGY") then
@@ -289,7 +291,7 @@ function utils.handle_electrical_sensor_info(device)
289291

290292
if electrical_ep_has_feature("NODE_TOPOLOGY") then
291293
-- ElectricalSensor EP has a NODE topology, so this is the ONLY Electrical Sensor EP
292-
device:set_field(fields.profiling_data.POWER_TOPOLOGY, clusters.PowerTopology.types.Feature.NODE_TOPOLOGY)
294+
device:set_field(fields.profiling_data.POWER_TOPOLOGY, clusters.PowerTopology.types.Feature.NODE_TOPOLOGY, {persist=true})
293295
-- associate this EP's electrical tags with the first OnOff EP. These are not necessarily the same EP.
294296
local tags = ""
295297
if electrical_ep[clusters.ElectricalPowerMeasurement.ID] then tags = tags.."-power" end
@@ -306,7 +308,7 @@ function utils.handle_electrical_sensor_info(device)
306308
end
307309

308310
-- no Electrical Sensor EPs are supported
309-
device:set_field(fields.profiling_data.POWER_TOPOLOGY, false)
311+
device:set_field(fields.profiling_data.POWER_TOPOLOGY, false, {persist=true})
310312
end
311313

312314
return utils

0 commit comments

Comments
 (0)